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

'X-Accel-Redirect' #1543

Open
ashrafalzyoud opened this issue Aug 19, 2024 · 0 comments
Open

'X-Accel-Redirect' #1543

ashrafalzyoud opened this issue Aug 19, 2024 · 0 comments

Comments

@ashrafalzyoud
Copy link

Hi
In production.rb
When u using nginx u must uncomment these lines to serve files

config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? 

config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

I'm trying to configuration my nginx
Nginx Configuration
Define the internal location:
Add a location block in your Nginx configuration to handle the internal redirects. For example:

location /protected/ {
    internal;
    alias /path/to/protected/files/;
}

Set the X-Accel-Mapping header:
Ensure that the X-Accel-Mapping header maps the real file path to the internal location. For example:

location / {
    proxy_set_header X-Accel-Mapping /path/to/protected/files/=/protected/;
}

But all my attachments and thumbs give 404

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

No branches or pull requests

2 participants