I ran into a strange behaviour the other day on a site (part of a network) that uses the multi_language plugin Polylang on a server with Nginx caching. The plugin offers an option to detect the visitors browser language upon first visit to the homepage then and automatically redirect them to their preferred language (if available).
The issue was that this redirection seemed to fail, or rather mis-redirect some of the time. And after some testing I could only conclude it was because these redirect responses where cached responses. (Duh)
There is probably no way around this, apart from deactivating the option in the Polylang plugin settings. But maybe someone has some ideas on how to make it work together?
The problem as I see it is that even if these redirect responses could be prevented from being cached (can they?) then the FastCGI Cache would still cache and serve the full home page response (in the default language) also to those that do need a redirect. Effectively this boils down to the same thing as disabling the redirects…
So maybe that would be the best solution to prevent weirder issues when the option is enabled:
Can short redirect responses be prevented from being cached?
That would also be a good solution for a plugin like “Redirection” (nice tool for SEO) since that plugin tries to gather some request info / statistics for certain requests that need a redirection…
And what about 404’s. Are they cached?