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

HTTP_X_ACCEL_MAPPING in NGINX breaks CSS delivery #99

Open
kurttomlinson opened this issue Nov 16, 2017 · 0 comments
Open

HTTP_X_ACCEL_MAPPING in NGINX breaks CSS delivery #99

kurttomlinson opened this issue Nov 16, 2017 · 0 comments

Comments

@kurttomlinson
Copy link

I recently updated my NGINX configuration to allow Rails to hand off file downloads to NGINX. Unfortunately, this breaks the CSS for delayed_job_web. My NGINX configuration is below.

With my new configuration, the CSS for delayed_job_web breaks. I know this is related to https://github.com/ejschmitt/delayed_job_web#serving-static-assets, but I can't figure out how to fix it. If I comment out the "passenger_env_var HTTP_X_ACCEL_MAPPING ..." line, then the CSS in delayed_job_web works, but NGINX no longer takes control of sending files.

Is there a way to adjust the HTTP_X_ACCEL_MAPPING header so that I can use delayed_job_web and offload sending files to NGINX?

server {
    listen              7000;
    server_name         localhost;
    root                /www/pricer_pro/public;   # <--- be sure to point to 'public'!
    passenger_enabled   on;
    rack_env            development;
    # Allow NGINX to serve any file in /www/pricer_pro/__send_file
    # via a special internal-only location.
    location /__send_file_accel {
      internal;
      alias /www/pricer_pro/__send_file;
    }
    passenger_set_header X-Sendfile-Type "X-Accel-Redirect";
    passenger_env_var HTTP_X_ACCEL_MAPPING /www/pricer_pro/__send_file/=/__send_file_accel/;
    passenger_pass_header X-Accel-Redirect;
}
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

1 participant