Created
November 14, 2009 11:11
-
-
Save julik/234480 to your computer and use it in GitHub Desktop.
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
# Lighttpd sets the wrong SCRIPT_NAME and PATH_INFO if you mount your | |
# FastCGI app at "/". This middleware fixes this issue. This is also | |
# modified to account for the case when SCRIPT_NAME is the name of the | |
# 404 script | |
class LightyWorkaround | |
def initialize(app) | |
@app = app | |
end | |
def call(env) | |
uri, qs = env["REQUEST_URI"].to_s.split('?') | |
@app.call(env.merge("PATH_INFO" => uri, "QUERY_STRING" => (qs || ''), "SCRIPT_NAME" => "")) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment