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

Passengers standalone's nginx configuration adds unexpected extra caching directives to non-fingerprinted asset filenames #1225

markoudev opened this Issue Jul 1, 2014 · 0 comments


None yet
2 participants

markoudev commented Jul 1, 2014

The issue is that I cannot load an asset file from any other web location where the fingerprinted file name cannot be generated. A browser will load the requested file once and then keep it in cache forever because of added caching directives for all files in /assets/. This is desired behaviour for files with a fingerprint that will never be updated, but not suited for if you want to refer to the file from a different location.

What steps will reproduce the problem?
curl -I any asset file that doesn't have a fingerprint in its filename.

What is the expected output? What do you see instead?
I expect no extra caching directives in the HTTP header for non-fingerprinted files, but curl -I https://.../assets/file.js returns:

Expires: Thu, 31 Dec 2037 23:55:55 GMT
Cache-Control: max-age=315360000
Cache-Control: public

What version of Phusion Passenger are you using?
Phusion Passenger version 4.0.42

Which version of Ruby, Rails, Node.js or Meteor are you using? On what operating system?
Ruby 2.0.0p481 and Rails 4.1.1 on Debian.

From line 151 in passenger-enterprise-server-4.0.42/resources/templates/standalone it configures the following:

# Rails asset pipeline support.
location ~ ^/assets/ {
    error_page 490 = @static_asset;
    error_page 491 = @dynamic_request;
    recursive_error_pages on;

    if (-f $request_filename) {
        return 490;
    if (!-f $request_filename) {
        return 491;
location @static_asset {
    gzip_static on;
    expires max;
    add_header Cache-Control public;
    add_header ETag "";
location @dynamic_request {
    passenger_enabled on;

Instead, I expected the location matching for nginx to be something like location ~ "^/assets/.*-[0-9a-f]{32}.*".

@FooBarWidget FooBarWidget added this to the 4.0.48 milestone Jul 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment