Set-Cookie is missing via proxy
Isaac Hailperin
i.hailperin at heinlein-support.de
Mon Dec 17 10:01:06 UTC 2012
On 12/06/2012 05:02 PM, Maxim Dounin wrote:
>> location ~* \.(jpg|gif|png|css|js)
>> {
>> try_files $uri @proxy;
>> }
>>
>> location @proxy
>> {
>> proxy_pass http://backend-all-apaches;
>> }
>>
>> location /
>> {
>> proxy_pass http://backend-all-apaches;
>> }
>>
>> As far as my understanding goes, this will only cache
>> jpg|gif|png|css|js files, and send the rest directly to the backend.
>> Please correct me if I am wrong.
>
> You are wrong. It tries to lookup jpg/gif/png/css/js files
> directly on the file system as static files, but it's
>
> 1) Not cache. Cache is activated with proxy_cache directive, see
> http://nginx.org/r/proxy_cache.
>
> 2) Not related to html files you talked about.
>
> 3) Not related to the response in question as headers clearly
> indicate it was originally returned by Apache (note ETag in Apache
> format).
>
> Whether or not the response in question was cached can't be
> concluded from the information provided. Most likely it was as
> config says to cache all 200 responses (without cookies) for 60
> minutes.
Thank you Maxim, that was very helpfull! So indeed, my config was wrong,
so in debugging the original problem, I made wrong assumptions.
Now for the original problem:
The Set-Cookie was not missing, but it turned out that having
proxy_set_header Host $host;
twice as I did accidentally, "confused" the backend, which is why it did
not deliver the Set-Cookie header. Removing one instance solved that
problem. But that did not solve the session mixing. The session mixing
was due to
proxy_ignore_headers X-Accel-Expires Expires Cache-Control;
I set this earlier, because not every page set those headers correctly,
resulting in suboptimal cacheing. But it turns out that its really
needed for other pages, so I removed that line again. This solved the
session mixing problem.
Isaac
More information about the nginx
mailing list