Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NGINX proxy to a Zeit Now deployment

I have several application server running several Node applications (via PM2).

I have one NGINX server which has the SSL certificate for the domain and reverse-proxies to the Node applications.

Within the NGINX configuration file I set the domains with their location block like this:

server {
        listen 443 ssl;
        server_name
          geolytix.xyz;

        ssl_certificate /etc/letsencrypt/live/geolytix.xyz/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/geolytix.xyz/privkey.pem;

        location /demo {
            proxy_pass http://159.65.61.61:3000/demo;
            proxy_set_header HOST $host;
            proxy_buffering off;
        }

        location /now {
            proxy_pass https://xyz-heigvbokgr.now.sh/now;
            proxy_set_header HOST $host;
            proxy_buffering off;
        }
}

This only works for the application server. The proxy to the Zeit Now deployment yields a bad gateway. The application itself work as expected if I go to the Zeit Now address of my deployment.

Does anybody know whether I might be missing some settings to proxy to Zeit Now?

like image 849
Dennis Bauszus Avatar asked Jun 20 '18 13:06

Dennis Bauszus


People also ask

Can I use nginx as a forward proxy?

By using the nginx forward proxy we can masking the location and IP for gaining access to services. Nginx forward proxy will continuing the request on behalf of the client. At the time when the host server will accept the request then only we can see the IP of the nginx proxy server.

Can Nginx do reverse proxy?

NGINX Plus is a software load balancer, API gateway, and reverse proxy built on top of NGINX.

Is nginx proxy manager a load balancer?

Nginx Proxy Manager is a tool in the Load Balancer / Reverse Proxy category of a tech stack.


1 Answers

now servers require the use of SNI for https connections. Like almost all modern webservers. You need do add

proxy_ssl_server_name    on;

to your configuration.

The smallest location block would be the following:

location / {
     proxy_set_header        host my-app.now.sh;
     proxy_ssl_server_name   on;
     proxy_pass              https://alias.zeit.co;
}
like image 56
user3070286 Avatar answered Sep 27 '22 22:09

user3070286