0
server {
    listen 5000;
    listen [::]:5000;
    server_name localhost;
    root E:\NG9B2C\B2C\dist\B2C\browser;
  
    http2_max_field_size 64k;
    http2_max_header_size 512k;
  
    location / {
        proxy_pass http://127.0.0.1:4000;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_cache_bypass $http_upgrade;
        proxy_redirect off;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
    
    
    location /YTB/api {
             
        proxy_pass http://localhost:8073/YTB/api/;   
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-NginX-Proxy true;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_cache_bypass $http_upgrade;
        proxy_redirect off;
        proxy_connect_timeout 1600;
        proxy_send_timeout 1600;
        proxy_read_timeout 1600;
        send_timeout 1600;
        proxy_set_header X-Forwarded-Proto $scheme;
    }

When I directly hit the api url : http://localhost:8073/YTB/api/... - the SEO works and is properly rendered on the page source. But when I route it through a reverse proxy : http://localhost:4000/YTB/api/... , the SEO content does not wait.

3
  • Could it be that the normal endpoint returns very fast, while your proxy takes more time? Check out this answer: stackoverflow.com/a/66699719/4371525 Commented Apr 14, 2021 at 12:55
  • proxy is much faster than normal endpoint. But not able to understand why Angular SSR does not wait for the proxy to return response from the api while it waits for the normal endpoint. Commented Apr 14, 2021 at 20:31
  • All I get is a proxy location / rendered page souce , but not of /YTB/api Commented Apr 14, 2021 at 20:32

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.