Monday, 11 February 2019

Serve 302 Found with Nginx in Express

Hello. I have a small issue with my Express + Nginx proxy setup. Requests to some pages in my project should be redirected to the homepage with http code 302 Found and Location header. My Nginx config:location / { proxy_pass http://localhost:3001; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_cache_bypass $http_upgrade; } So the problem is that when I make res.status(302) it works just fine, but response body is empty. All I want is nginx to serve this code properly to the client (and robots) and show up the nginx default response body:

302 Found


nginx/1.15.7
Is there any way to make it work?

Submitted February 11, 2019 at 01:02PM by JamesJGoodwin

No comments:

Post a Comment