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;
                include snippets/;
                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;
        return 403;
location ~ 3001 
#       proxy_pass;
        return 502;

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

Your Answer