We have a NextJS App which is linking to our Angular App under the same primary domain but a separate document root. I have reviewed many help articles but cant seem to triage our issue.
Companydomain.com document root is (NextJS Site): /var/www/html/app-live/dist/out Angular App Document root is: /var/www/html/app-live/dist/en
I can navigate from NextJS site to the Angular site and get the correct angular page but when I link directly or refresh I get a 404.
I have modified the httpd.conf for the site as such
<VirtualHost *:80>
ServerName Companydomain.com
ServerAlias www.Companydomain.com
DocumentRoot "/var/www/html/app-live/dist/out"
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule .* https://%{HTTP:Host}%{REQUEST_URI} [L,R=permanent]
Alias /en/framesite/Bellas/103 /var/www/html/app-live/dist/en/framesite/Bellas/103
<Directory "/var/www/html/app-live/dist/en/store/Bellas/103/">
RewriteEngine on
Require all granted
AllowOverride All
</Directory>
Alias /en /var/www/html/app-live/dist/en
</VirtualHost>`
I have also run service httpd restart
What am I missing?
2
Answers
I don't think this is the best solution but it worked for my immediate needs.
I was able to truncate the aliased location file to /var/www/html/app-live/dist/en/ and the pages resolved correctly
Alias /en/framesite/Bellas/103 /var/www/html/app-live/dist/en/
I think youre trying to make a reverse proxy for your angular app from a subdirectory that is present in NEXTJS domain. The errors appearing are because of the issues of configuration. Check these things: