Serving gzipped (.gz) on Passenger Enterprise 5.1 + Apache

11 views
Skip to first unread message

Nicholai de Guzman

unread,
Dec 27, 2016, 2:59:26 PM12/27/16
to Phusion Passenger Discussions
Hello,

Does the newest Passenger handle serving .gz files generated by Rails 4.2.5? Passenger (Apache) seems to only serve the minified (not compressed) versions of application.js and application.css.
From https://www.phusionpassenger.com/library/dev/ruby/rails_integration.html (Asset pipeline section) , it looks like Passenger + Nginx is the only one that can do this?

Any recommendation for Apache?

My server details:
Apache/2.4.6 (Red Hat Enterprise Linux)
Rails  4.2.5
Passenger 5.1

Thank you.

Daniel Knoppel

unread,
Jan 2, 2017, 7:30:47 AM1/2/17
to Phusion Passenger Discussions
It's not so much something Passenger "handles", it's more that the default standalone (Nginx) config defines asset pipeline rules. So if you use the Nginx or Apache integration mode, you need to add those rules yourself.

We have an example for Nginx, you can "translate" these to Apache:

# Rails asset pipeline support.
location ~ "^/assets/.+-([0-9a-f]{32}|[0-9a-f]{64})\..+" {
    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;
}

Feel free to submit it to the library if you find a working example, so we can add it under the Nginx example :) 

- Daniel
Reply all
Reply to author
Forward
0 new messages