Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only the index is cached, any other page are BYPASSED #22

Open
Mayeu opened this issue Jul 28, 2018 · 4 comments
Open

Only the index is cached, any other page are BYPASSED #22

Mayeu opened this issue Jul 28, 2018 · 4 comments

Comments

@Mayeu
Copy link

Mayeu commented Jul 28, 2018

Hello,

I followed your tutorial to setup fast-cgi caching, and right now the

if ($query_string != "") {
       set $skip_cache 1;
}

test makes caching to always fails for anything but the index.

The reason seems to be that when a post is loaded, the $query_string contains the path of the post q=/2018/07/28/never-cached/& (I use a header to see that:
add_header X-query-string "$query_string";)

Thus, the page always return "BYPASS".

I am not sure how one could discriminate what should be cached in that case. Any idea?

@decimoseptimo
Copy link

How about using pretty urls?

@Mayeu
Copy link
Author

Mayeu commented Nov 15, 2018

@decimoseptimo Can you explicit what you mean? Note that I don't know WordPress that much, I am just a humble sysadmin :)

As far as I see at my server level, the way WordPress work is by turning the https://example.com/2018/07/28/article/ pretty URL into something akin to https://example.com/index.php?q=/2018/07/28/article/. Thus I am using pretty URLs, but the server still get a URL with a query at the end.

@decimoseptimo
Copy link

I recommend you to fork this repo in your server so that you make sure this is your base. You'll notice that https://github.com/A5hleyRich/wordpress-nginx/blob/master/global/server/fastcgi-cache.conf defines the 4 scenarios that can trigger the BYPASS you see. I have no idea which one is affecting you, but for sure something in your codeis triggering it.

Comment out one at a time, reset nginx, and make tests.

@Mayeu
Copy link
Author

Mayeu commented Nov 16, 2018

As I have said in my very first comment, what trigger the bypass is the query string check, which always trigger but on the home page 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants