Skip to content

Instantly share code, notes, and snippets.

@jbbarth
Created December 31, 2012 14:18
Show Gist options
  • Save jbbarth/4420031 to your computer and use it in GitHub Desktop.
Save jbbarth/4420031 to your computer and use it in GitHub Desktop.
Rack middleware for Redmine to fix bad effects of our 2nd reverse-proxy
require 'rack/utils'
class FixScnHeadersMiddleware
def initialize(app)
@app = app
end
def call(env)
if env["HTTP_X_FORWARDED_HOST"]
env["HTTP_X_FORWARDED_HOST"].gsub!(/,\s?[^,]+.ac.cs$/,"")
end
@app.call(env)
end
end
RedmineApp::Application.config.middleware.use FixScnHeadersMiddleware
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment