5

For a project of mine, I need to wire up a long chain of machines that are essentially proxying the HTTP requests for each other. It goes like this:

Web client - A - B/C - D

When a request is made from the browser, it first goes through a thin PHP proxy layer, located on the local machine of the user, whose purpose is to resolve complications with cross domain requests and so on. It proxies to machine B - just an nginx instance, which rewrites the URL and proxies to C. C does some necessary modifications, before proxying to D, obtaining the response, and returning it back to the web client. D is a remote service API which cannot be touched.

I have problems setting up a session cookie on machine C, which gets all the way down to the original request. Although setting the cookie is possible, when a new request is there, it is not visible in Chrome network inspector, and node C returns a nullpointerexception when I try to get a value from the apparently nonexistent cookie.

I suppose, it boils down to tweaking the way nginx proxies the requests.

Preslav Rachev
  • 151
  • 1
  • 1
  • 4

1 Answers1

2

Check if you have following settings in nginx configuration at C in server {} block:

    proxy_pass_header  Set-Cookie;
    proxy_pass_header  P3P;

that would be enough to pass cookies.

Andrei Mikhaltsov
  • 2,987
  • 1
  • 22
  • 31