Re: Response Header IF statement problem

2018-02-16 Thread Francis Daly
On Fri, Feb 16, 2018 at 01:49:59PM +, Friscia, Michael wrote: Hi there, > Thank you, this was incredibly useful and helped me think this through in > Nginx terms and I have everything working now. Thank you again! You're welcome. Good to hear that you have things working the way you want t

Re: Response Header IF statement problem

2018-02-16 Thread Friscia, Michael
Thank you, this was incredibly useful and helped me think this through in Nginx terms and I have everything working now. Thank you again! Minor side question, is there a variable I can use to post to a debug header to indicate if a page was newly written to the cache versus a page that was read

Re: Response Header IF statement problem

2018-02-16 Thread Francis Daly
On Thu, Feb 15, 2018 at 01:22:04PM +, Friscia, Michael wrote: Hi there, > To add one more thing. I mentioned that my testing failed. Exactly what was > failing is that the map{} block that worked and then stopped working was the > problem, the $nocache variable would always return the defau

Re: Response Header IF statement problem

2018-02-15 Thread Friscia, Michael
To add one more thing. I mentioned that my testing failed. Exactly what was failing is that the map{} block that worked and then stopped working was the problem, the $nocache variable would always return the default value no matter what I did. So in a previous post the suggested code was proxy_

Re: Response Header IF statement problem

2018-02-15 Thread Friscia, Michael
Yes, I should have explained the problem up front. I made the wrong assumption I was asking a simple question and quickly realized I was getting good answers but my approach was likely flawed from the start. We are using Nginx just as a cache mechanism across many custom DNS names. As a result

Re: Response Header IF statement problem

2018-02-14 Thread Peter Booth
I think that part of the power and challenge of using nginx’s caching is that there are many different ways of achieving the same or similar results, but some of the approaches will be more awkward than others. I think that it might help if you could express what the issue is that you are try

Re: Response Header IF statement problem

2018-02-14 Thread webopsx
Hi, Yes NGINX can inspect the header, See the following full example. It will check for the match of "true" case-insensitive. I am simulating your backend on port 81. Does this make sense? map $upstream_http_x_secured_page $nocache { ~*true "1"; default

Re: Response Header IF statement problem

2018-02-14 Thread Friscia, Michael
Maybe that’s the problem, I want to disable cache if the response header is true but not do anything if it is false. I can change my logic in creating this header to only have it on pages where cache should be disabled if it is not possible to use an IF statement around it. I will post my config

Re: Response Header IF statement problem

2018-02-14 Thread webopsx
Hi, The map is processed on each request and should be very consistent. I thought you wanted to disable cache on the existence of a response header, not a request header. Otherwise I think we need more information to understand, such as how are you testing? Perhaps paste your full configuration

Re: Response Header IF statement problem

2018-02-14 Thread Friscia, Michael
Ok, so I did this and it worked and then it stopped working, then it worked again and then stopped working. I literally used the code below, the map appears right above my server {} block. When it worked I was passing a header with the $nocache value set and it was consistently returning the co

Re: Response Header IF statement problem

2018-02-14 Thread Friscia, Michael
Ok, I think this sends me into the correct direction. Thanks for posting the links and explaining the _bypass, I was setting both _bypass and _no_cache because I wasn’t sure. ___ Michael Friscia Office of Communications Yale School of Medicine (203) 737-79

Re: Response Header IF statement problem

2018-02-14 Thread webopsx
You can use map for this... - http://nginx.org/en/docs/http/ngx_http_map_module.html#map map $upstream_http_x_secured_page $nocache { "search string" "1" default ""; } location /foo { ... proxy_no_cache $nocache; } Posted at Nginx Forum: https:/

Re: Response Header IF statement problem

2018-02-14 Thread webopsx
Hi, If I understand correctly you actually don't want to cache specific responses (not bypass). The proxy_cache_bypass is only for if the response has already been cached and defines the behavior in which NGINX should serve the cached version to a client. Therefore if I understand correctly, you

Re: Response Header IF statement problem

2018-02-14 Thread Friscia, Michael
Thank you Roman, but this raises a different question, if I want to base this on the value and not the existence, is that still possible? ___ Michael Friscia Office of Communications Yale School of Medicine (203) 737-7932 - office (203) 931-5381 - mobile ht

Re: Response Header IF statement problem

2018-02-14 Thread Roman Arutyunyan
Hi Michael, On Wed, Feb 14, 2018 at 02:09:57PM +, Friscia, Michael wrote: > I’m at a loss on this. I am working on a cache problem where some pages need > to be bypassed and others will be cached. So the web server is adding a > response header (X-Secured-Page). I’ve tried multiple combinati

Response Header IF statement problem

2018-02-14 Thread Friscia, Michael
I’m at a loss on this. I am working on a cache problem where some pages need to be bypassed and others will be cached. So the web server is adding a response header (X-Secured-Page). I’ve tried multiple combinations of $http_x_secured_page and $sent_http_x_secured_page and even though I see the