node.jsapachealiasvhostsproxypass

Apache Alias and proxy pass in the same domain


I have a issue with vhost configuration in Apache/2.4.58

I have a NodeJs frontend and laravel api backend.

This is my vhost:

<VirtualHost *:443>
  ServerName backend.mydomain.com

  ProxyRequests Off
  ProxyPreserveHost On

  # Alias for backend application
  ProxyPass /be !
  Alias /be /var/www/html/product_importer/public

  <Directory "/var/www/html/product_importer/public">
        Options Indexes FollowSymLinks MultiViews
        AllowOverride All
        Order allow,deny
        allow from all
  </Directory>
  ProxyPass / http://127.0.0.1:3000/

  [... error logs and ssl config]

</VirtualHost>

I want to all requests start with /be must be managed by laravel and the others with NodeJs, but the route /be works with laravel, but the other routes starting with /be (like /be/user ) works with NodeJs

What I doing wrong?


Solution

  • Solved adding rule in .htaccess of laravel folder

    RewriteBase /be