0

My application runs on a Nginx and passenger server. Inside the production.rb I see a line says:

# Specifies the header that your server uses for sending files.
config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX

How does it Specifies header to sending files? How does Rails sends file without having this turned on?

Is it a good practice so turn this on? Does it make my application to run faster?

1 Answer 1

1

The behavior is explained in the send_file documentation

You should use this option, it will make your application faster and it is good practice to do so.

If you don't use this option, the file will be read by the ruby process, sent to nginx and then to the client.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.