Last active
October 9, 2016 12:50
-
-
Save sergio1990/6b0268b442135990407de321a2526fbc to your computer and use it in GitHub Desktop.
Set SCRIPT_NAME inside Rack middleware
This file contains 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 ::File.expand_path('../config/environment', __FILE__) | |
class ScriptName | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
env['SCRIPT_NAME'] += env['HTTP_FRONTEND_URI'].to_s if !Rails.env.development? | |
@app.call(env) | |
end | |
end | |
use ScriptName | |
run Rails.application |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment