Nginx cache returning empty response for just the home page

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Nginx cache returning empty response for just the home page

Jane Jojo

Here’s the issue in action [video]: https://d.pr/v/HmAiK0

 

I am using Nginx http caching extensively with the following cache key

 

proxy_cache_key "$scheme://$host$uri";

 

I know this is a cache issue because I can invalidate it with

 

proxy_cache_bypass $arg_nocache;

 

Here’s a video of that in action: https://d.pr/v/Bj5ey6

 

Now, this happens only to the homepage URL and the problem recurs after a while (I think after the cache expiry).

 

Can you help me understand why this is happening and what I can do to fix?

 

Here’s my code for reference:

charset utf-8;

proxy_cache_valid   200 301 302 1d;

proxy_redirect off;

proxy_cache_valid 404 1m;

proxy_cache_revalidate on;

proxy_cache_background_update on;

proxy_cache_lock on;

proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;

proxy_cache_bypass $arg_nocache;

 



_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Nginx cache returning empty response for just the home page

nginx mailing list
You need to understand what requests are being received, what responses are being sent and the actual keys being used to write to your cache. 

This means intelligent request logging, possibly use of redbot.org, and examination of your cache. I used to use a script that someone had posted here years ago that would dump cache contents along with cache keys.

Sent from my iPhone

On Oct 6, 2018, at 5:51 PM, Jane Jojo <[hidden email]> wrote:

Here’s the issue in action [video]: https://d.pr/v/HmAiK0

 

I am using Nginx http caching extensively with the following cache key

 

proxy_cache_key "$scheme://$host$uri";

 

I know this is a cache issue because I can invalidate it with

 

proxy_cache_bypass $arg_nocache;

 

Here’s a video of that in action: https://d.pr/v/Bj5ey6

 

Now, this happens only to the homepage URL and the problem recurs after a while (I think after the cache expiry).

 

Can you help me understand why this is happening and what I can do to fix?

 

Here’s my code for reference:

charset utf-8;

proxy_cache_valid   200 301 302 1d;

proxy_redirect off;

proxy_cache_valid 404 1m;

proxy_cache_revalidate on;

proxy_cache_background_update on;

proxy_cache_lock on;

proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;

proxy_cache_bypass $arg_nocache;

 


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Nginx cache returning empty response for just the home page

Jane Jojo

Thanks for this Peter. I’ll look at redbot.

 

Do you by any chance have the script? My problem is intermittent and I don’t know if it’s a good idea to actively listen to production logging. 





On Sat, Oct 6, 2018 at 3:21 PM Peter Booth via nginx <[hidden email]> wrote:
You need to understand what requests are being received, what responses are being sent and the actual keys being used to write to your cache. 

This means intelligent request logging, possibly use of redbot.org, and examination of your cache. I used to use a script that someone had posted here years ago that would dump cache contents along with cache keys.

Sent from my iPhone

On Oct 6, 2018, at 5:51 PM, Jane Jojo <[hidden email]> wrote:

Here’s the issue in action [video]: https://d.pr/v/HmAiK0

 

I am using Nginx http caching extensively with the following cache key

 

proxy_cache_key "$scheme://$host$uri";

 

I know this is a cache issue because I can invalidate it with

 

proxy_cache_bypass $arg_nocache;

 

Here’s a video of that in action: https://d.pr/v/Bj5ey6

 

Now, this happens only to the homepage URL and the problem recurs after a while (I think after the cache expiry).

 

Can you help me understand why this is happening and what I can do to fix?

 

Here’s my code for reference:

charset utf-8;

proxy_cache_valid   200 301 302 1d;

proxy_redirect off;

proxy_cache_valid 404 1m;

proxy_cache_revalidate on;

proxy_cache_background_update on;

proxy_cache_lock on;

proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;

proxy_cache_bypass $arg_nocache;

 


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Nginx cache returning empty response for just the home page

nginx mailing list
I think that the script might have been this:


Also, the nginx debug log shows you *everything* at 100x the level of detail I expected.
It can be overwhelming  though

When you say that the issue is intermittent do you mean that you make 
the same request and get different results?


As for listening to production logging, it needn’t be an issue

On 7 Oct 2018, at 4:57 PM, Jane Jojo <[hidden email]> wrote:

Thanks for this Peter. I’ll look at redbot.

 

Do you by any chance have the script? My problem is intermittent and I don’t know if it’s a good idea to actively listen to production logging. 




On Sat, Oct 6, 2018 at 3:21 PM Peter Booth via nginx <[hidden email]> wrote:
You need to understand what requests are being received, what responses are being sent and the actual keys being used to write to your cache. 

This means intelligent request logging, possibly use of redbot.org, and examination of your cache. I used to use a script that someone had posted here years ago that would dump cache contents along with cache keys.

Sent from my iPhone

On Oct 6, 2018, at 5:51 PM, Jane Jojo <[hidden email]> wrote:

Here’s the issue in action [video]: https://d.pr/v/HmAiK0

 

I am using Nginx http caching extensively with the following cache key

 

proxy_cache_key "$<a href="scheme://$host$uri" class="">scheme://$host$uri";

 

I know this is a cache issue because I can invalidate it with

 

proxy_cache_bypass $arg_nocache;

 

Here’s a video of that in action: https://d.pr/v/Bj5ey6

 

Now, this happens only to the homepage URL and the problem recurs after a while (I think after the cache expiry).

 

Can you help me understand why this is happening and what I can do to fix?

 

Here’s my code for reference:
charset utf-8;
proxy_cache_valid   200 301 302 1d;
proxy_redirect off;
proxy_cache_valid 404 1m;
proxy_cache_revalidate on;
proxy_cache_background_update on;
proxy_cache_lock on;
proxy_cache_use_stale  error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_bypass $arg_nocache;

 


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx