Questions about solutions when using proxy_cache to redirect to cached pages for non logged in users.
Zev Blut
zblut at cerego.co.jp
Tue Feb 16 13:18:56 MSK 2010
Hello!
Thanks for the comments.
Let me look into the Cookie and Vary answers in a later mail.
Below, is my reply about the proxy_pass question.
On 02/16/2010 06:59 PM, Maxim Dounin wrote:
> Hello!
>
> On Tue, Feb 16, 2010 at 05:25:43PM +0900, Zev Blut wrote:
>
>> Hello,
>>
>> I am trying out the proxy_cache commands in nginx. The recent mails
>> on the mailing list have been quite helpful for figuring out what to
>> do. I am able to use nginx to cache pages for non logged in users and
>> have logged in users go directly to the backend.
>>
>> I have a few questions about if I am calling proxy_pass correctly, and
>> if I can use proxy_pass_header to only let a certain Set-Cookie header
>> through.
>>
>> * in location / I rewrite to either the logged in or not logged in states.
>> But, I have to explicitly regex catch the real uri and add the args
>> to the proxy pass.
>> i.e.
>>
>> http://example.com/search?keword=nginx
>>
>> would lose the ?keyword=nginx if I just used
>> proxy_pass http://app/$1
>>
>> Is my solution for calling "proxy_pass http://app/$1?$args;" correct?
>
> This should work, but it's just waste of cpu. Use
>
> location /not_logged_in_user/ {
> proxy_pass http://app/;
> ...
> }
>
> instead.
Yes, I tried this, but then app behind the proxy_pass gets a request like:
/not_logged_in_user/search?keyword=nginx
Which it fails on, because it does not recognize /not_logged_in_user/ or
/logged_in_user/ as part of its' path. Of course I could change the
backend app to recognize these paths, but that would be more wasted cpu
than having nginx do it.
Or am I missing something?
Thanks,
Zev
More information about the nginx
mailing list