I am trying to integrate a WordPress plugin (Jetpack\'s Related Posts module) which adds query strings to the end of post URLs. I would like to cache URLs with FastCGI while com
Just now, I had similar problem. So, my solution:
In the nginx config add to the
http {
...
map $request_uri $request_path {
~(?<captured_path>[^?]*) $captured_path;
}
...
}
Then you will have a variable $request_path, which contains $request_uri without query_string.
So use $request_path for cache key
fastcgi_cache_key "$scheme$request_method$host$request_path"
Important. The "map" directive can be added only to "http {}". This directive will be execute for all requests for all hosts.