Skip to main content

Nginx proxy pass for muliple node apps [Resolved]

We are running a multinode application on different ports on a single server. We are trying to use nginx as a reverse proxy to route requests to the different applications, depending on the match of a string in the request URI.

We are using the location directive to match that string and route accordingly. If we return some value matching the strings in the location directive, it works fine. But as soon it is used in proxy_pass we only see a 402 error. What are we doing wrong?

Our config:

server {

                listen 443 ssl;
                listen [::]:443 ssl;
                server_name abc.xyz.co;
                include snippets/ssl-qaapp.xyz.co.conf;
                include snippets/ssl-params.conf;
                add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload; always';

location / 

{
        root /var/www/html/abc;
}

location ~ 3000 
{
#       proxy_pass https://127.0.0.1:3000;
        return 403;
        }
location ~ 3001 
{
#       proxy_pass https://127.0.0.1:3001;
        return 502;
       }
}

Question Credit: rabbi bhumbla
Question Reference
Asked June 14, 2019
Posted Under: Network
29 views
1 Answers

Your Answer
D:\Adnan\Candoerz\CandoProject\vQA