Created
December 31, 2012 14:18
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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