skip to Main Content

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


  1. Chosen as BEST ANSWER

    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/


  2. 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:

    1. Build the angular app correctly.
    2. Deploy this app to the correct location and double check it i.e in your case it is/var/www/html/app-live/dist/en
    3. Check again that all the files are present and none of them is deleted.
    4. Also check that permission is given.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search