Welcome! Log In Create A New Profile

Advanced

Re: Nginx multiple upstream map conditions

August 31, 2016 09:17PM
c0nw0nk Wrote:
-------------------------------------------------------
> Francis Daly Wrote:
> -------------------------------------------------------
> > On Wed, Aug 31, 2016 at 01:30:30PM -0400, c0nw0nk wrote:
> >
> > Hi there,
> >
> > > Thanks works a treat is it possible or allowed to do the
> following
> > in a
> > > nginx upstream map ? and if so how i can't figure it out.
> >
> > I think it is logically impossible.
> >
> > > I cache with the following key.
> > > fastcgi_cache_key
> > > "$session_id_value$scheme$host$request_uri$request_method";
> >
> > fastcgi_cache_key is the thing that nginx calculates from the
> request,
> > before it decides whether to send the response from cache, or
> whether
> > to pass the request to upstream.
> >
> > > if the upstream_cookie_logged_in value is not equal to 1 how can
> I
> > set
> > > $session_id_value ''; make empty
> >
> > $upstream_cookie_something is part of the response from upstream,
> > so is not available to nginx at the time that it is calculating
> > fastcgi_cache_key for the "read from cache or not" decision.
> >
> > Am I missing something?
> >
> > f
> > --
> > Francis Daly francis@daoine.org
> >
> > _______________________________________________
> > nginx mailing list
> > nginx@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx
>
>
> Thanks :) so changes to that value will have no effect.
>
> What about the following scenario.
>
> I remove all Set-Cookie headers.
> fastcgi_hide_header Set-Cookie;
>
>
> Then add them back in with :
> add_header Set-Cookie "$upstream_http_set_cookie";
>
> Will requests that get a cache hit ever contain a Set-Cookie header or
> isit only the ones that reach the origin php server.
>
> From my tests it appears to be working that no set-cookie headers are
> present on "X-Cache-Status : HIT" headers.

With :
fastcgi_hide_header Set-Cookie;

I think i should allow myself to add set-cookie headers to fresh origin requests like this.

map $upstream_cache_status $upstream_value_status {
~MISS $upstream_http_set_cookie;
~BYPASS $upstream_http_set_cookie;
~EXPIRED $upstream_http_set_cookie;
}
add_header Set-Cookie $upstream_value_status;

I have not tested this yet though.

http://www.networkflare.com/
Subject Author Posted

Nginx multiple upstream map conditions

c0nw0nk August 30, 2016 02:25PM

Re: Nginx multiple upstream map conditions

Valentin V. Bartenev August 31, 2016 07:06AM

Re: Nginx multiple upstream map conditions

c0nw0nk August 31, 2016 01:30PM

Re: Nginx multiple upstream map conditions

c0nw0nk August 31, 2016 01:42PM

Re: Nginx multiple upstream map conditions

Francis Daly August 31, 2016 05:58PM

Re: Nginx multiple upstream map conditions

c0nw0nk August 31, 2016 06:44PM

Re: Nginx multiple upstream map conditions

c0nw0nk August 31, 2016 09:17PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready