0

I'm trying to proxy_pass_header Connection; to my node.js server. But my response header getting overwritten Connection : keep-alive Even when I explicitly changed the Connection : close.

What I'm doing wrong?

1 Answer 1

1

That is because you have nginx in front and that will respond based on its own settings. You should use below directive in your nginx conf if you don't want to keep connection alive

keepalive_timeout 0;
Sign up to request clarification or add additional context in comments.

5 Comments

It solves the problem but right now I'm facing another. keepalive_timeout 0; dosen't let node response header to be Connection: keep-alive. It's always close.
What I really want is to control the Connection from node.js based on some logic. Is it possible?
Try this add_header Connection $upstream_http_connection;. This will try and response with your upstream connection response header
Also see if this is needed stackoverflow.com/questions/10395807/…

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.