Maxim Dounin
February 26, 2017 08:16AM
Hello!

On Sun, Feb 26, 2017 at 10:43:53AM +0100, Jean-Paul Hemelaar wrote:

> Hi all,
>
> I tested the new proxy_cache_background_update function to serve stale
> content while fetching an update in the background.
>
> I ran into the following issue:
> - PHP application running on www.example.com
> - Root document lives on /index.php
>
> As soon as the cache has expired:
> - A client requests http://www.example.com/
> - Nginx returns the stale response
> - In the background Nginx will fetch
> http://www.mybackend.com/index.html (index.html
> instead of index.php or just /)
> - The backend server returns a 404 (which is normal)
> - The root document remains in stale state as Nginx is unable to fetch it
> properly
>
> As a workaround I included "rewrite ^/index.html$ / break;" to rewrite the
> /index.html call to a simple / for the backend server.
> This works, but is not ideal.
>
> Is there a better way to tell Nginx to just fetch "/"?

Please show your configuration.

In the background nginx is expected to fetch the same resource
that was originally requested. It uses a separate subrequest
though, so it might end up requesting a different resource when
using some non-trivial configurations where a resource requested
depends on additional factors which are different in the
subrequest.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Using proxy_cache_background_update

Jean-Paul Hemelaar February 26, 2017 04:46AM

Re: Using proxy_cache_background_update

Maxim Dounin February 26, 2017 08:16AM

Re: Using proxy_cache_background_update

jeanpaul February 26, 2017 01:08PM

Re: Using proxy_cache_background_update

Maxim Dounin February 26, 2017 10:04PM

Re: Using proxy_cache_background_update

jeanpaul February 27, 2017 05:53AM

Re: Using proxy_cache_background_update

Maxim Dounin February 27, 2017 05:52PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 235
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