Re: nginx caching proxy
Except the case when your site is returning "Vary: Accept-Encoding" for example and the 2 clients are using different Accept-Encoding headers (that's also true for whatever the Vary header is) :) On 10/25/18 4:20 PM, Roman Arutyunyan wrote: On Thu, Oct 25, 2018 at 07:21:35AM -0400, vizl wrote: And how about result cache file ? Will it be only 1 object in cache when 2 client GET 1 file SIMULTANEOUSLY or 2 different objects in Nginx proxy_cache_path ? Only one response can be cached for a single key. Once a new response is cached, previous one is discarded. -- -- Gryzli https://gryzli.info ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: nginx caching proxy
On Thu, Oct 25, 2018 at 07:21:35AM -0400, vizl wrote: > And how about result cache file ? > Will it be only 1 object in cache when 2 client GET 1 file SIMULTANEOUSLY or > 2 different objects in Nginx proxy_cache_path ? Only one response can be cached for a single key. Once a new response is cached, previous one is discarded. -- Roman Arutyunyan ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: nginx caching proxy
And how about result cache file ? Will it be only 1 object in cache when 2 client GET 1 file SIMULTANEOUSLY or 2 different objects in Nginx proxy_cache_path ? Posted at Nginx Forum: https://forum.nginx.org/read.php?2,281621,281686#msg-281686 ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: nginx caching proxy
Hello, On Wed, Oct 17, 2018 at 05:13:15AM -0400, drookie wrote: > Hello, > > I did't find the answer in documentation, but am I right, assuming from my > observation, that when the proxy_cache is enabled for a location, and the > client requests the file that isn't in the cache yet, nginx starts > transmitting this file only after it's fully received from the upstream ? > Because I'm seeing the lags equal to the request_time from the upstream. The short answer is no, nginx cache does not introduce any delays here. Maybe your client waits until it receives the full file before letting you know. When a client requests a file missing in the cache, then the file is requested from the upstream and it is sent to the client SIMULTANEOUSLY with saving it in the cache. However if another client requests a file currently being received and cached in the first client's context, and proxy_cache_lock is enabled, then this second client will wait for the file to be fully cached by nginx and only receives it from the cache after that. [..] -- Roman Arutyunyan ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Nginx caching proxy dns name even when using variables
Hi, On 27/09/2018 15:53, Maxim Dounin wrote: Hello! On Thu, Sep 27, 2018 at 03:27:03PM +0100, Rob Fulton wrote: I’ve done some further testing on this today and discovered that the configuration works correctly when the proxy_pass url is accessed via http, I can see dns queries for the proxy_server url every minute as per the ttl. The moment I change the url to https, this stops. Is this a known limitation? Most likely, the problem is that you have proxy_pass https://somehostname.com; somewhere in the configuration, without variables - so nginx resolves the name during configuration parsing. As a result, your construct set $proxy_server somehostname.com; proxy_pass https://$proxy_server; does not try to resolve the name, but rather ends up using the existing upstream for somehostname.com. Thank you very much for your help, you were correct I had a proxy_pass directive for a 404 error page to the same hostname configured without a variable, setting this correctly resulted in the correct behavior. Regards Rob ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Nginx caching proxy dns name even when using variables
Hello! On Thu, Sep 27, 2018 at 03:27:03PM +0100, Rob Fulton wrote: > I’ve done some further testing on this today and discovered that > the configuration works correctly when the proxy_pass url is > accessed via http, I can see dns queries for the proxy_server > url every minute as per the ttl. The moment I change the url to > https, this stops. Is this a known limitation? Most likely, the problem is that you have proxy_pass https://somehostname.com; somewhere in the configuration, without variables - so nginx resolves the name during configuration parsing. As a result, your construct set $proxy_server somehostname.com; proxy_pass https://$proxy_server; does not try to resolve the name, but rather ends up using the existing upstream for somehostname.com. If you want the name to be always resolved, comment out the proxy_pass without variables and/or use the variables there as well. -- Maxim Dounin http://mdounin.ru/ ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx
Re: Nginx caching proxy dns name even when using variables
Hi, I’ve done some further testing on this today and discovered that the configuration works correctly when the proxy_pass url is accessed via http, I can see dns queries for the proxy_server url every minute as per the ttl. The moment I change the url to https, this stops. Is this a known limitation? Regards Rob > On 26 Sep 2018, at 16:53, Rob Fulton wrote: > > Hi, > > I'm using nginx to proxy to a host with a rapidly changing dns entry but I > can't seem to get the proxy command the re-query dns using the vairable > method suggested, the following is a excerpt from my config : > > server { > > listen 443 ssl; > > resolver 127.0.0.1 valid=20s; > set $proxy_server somehostname.com; > > location / { > > proxy_pass https://$proxy_server/blue/content$request_uri; > > > I'm using nginx 1.14, watching my dns logs I see no requests following nginx > starting up. The upstream_addr value in my nginx logs also doesn't change. > > Any suggestions of why this isn't working as expected? > > Regards > > Rob > > > ___ > nginx mailing list > nginx@nginx.org > http://mailman.nginx.org/mailman/listinfo/nginx ___ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx