I've set up a Rails 3 proxy method inside a controller to use Nginx' X-Accel-Redirect to deliver a specific URI from a remote server if the user is allowed to.
Unfortunately, Rails always sends some kind of Content-Type header, which takes precedence over the one returned from the upstream server. I've tried various ways of "convincing" the response not to include any Content-Type header at all, but they have either no effect or raise an exception. The response body is of course empty, as it's ignored anyways.
The obvious ones I tried didn't 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, setting a specific Content-type, like "image/gif" works as intended, but the controller can't tell for sure what content is going to be delivered, unlike the remote server.
What would be the best (cleanest?) way for sending a response without that header?