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.


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.

  • I think the problem lies in the PHP side, not passing cookies around, via curl_php – Preslav Rachev May 16 '13 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.