How to cache js/css request containing a question mark?

log nginx-forum at
Mon Aug 31 15:59:40 UTC 2015

Following nginx configuration in a server block can cache js and css files
with "js" or "css" as the end of the url.

        location ~ .*\.(js|css)?$ {
                expires 7d;

But it can't cache request such as:

http: //


http: //

Any way to cache cs/jss files above? Or cache files based on the file type
of request instead of file name?

Posted at Nginx Forum:,261338,261338#msg-261338

More information about the nginx mailing list