I installed a Rails 3 proxy inside the controller to use Nginx X-Accel-Redirect to deliver a specific URI from a remote server, if the user is allowed.
Unfortunately, Rails always sends some Content-Type header, which takes precedence over the one returned from the upstream server. I tried various ways to “convince” the answer not to include the Content-Type header at all, but they either do not affect or throw an exception. The body of the answer, of course, is empty, since it is ignored in any case.
The obvious ones I tried do not work as the value remains "text / html; charset ...":
response.headers['Content-type'] = ''
response.headers['Content-Type'] = nil
response.headers['Content-Type'] = ''
response.content_type = ''
response.content_type = nil
Of course, installing a certain type of content, such as "image / gif", works as intended, but the controller cannot tell exactly what content will be delivered, unlike a remote server.
What would be the best (cleanest?) Way to send a response without this header?
source
share