Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds ability to configure a prefix for the internal url #467

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/better_errors/error_page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def rails_params
end

def uri_prefix
env["SCRIPT_NAME"] || ""
BetterErrors::Middleware.internal_url_prefix + (env["SCRIPT_NAME"] || "")
end

def request_path
Expand Down
8 changes: 8 additions & 0 deletions lib/better_errors/middleware.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,14 @@ def self.allow_ip!(addr)

CSRF_TOKEN_COOKIE_NAME = "BetterErrors-#{BetterErrors::VERSION}-CSRF-Token"

def self.internal_url_prefix
@internal_url_prefix || ""
end

def self.internal_url_prefix=(value)
@internal_url_prefix = value
end

# A new instance of BetterErrors::Middleware
#
# @param app The Rack app/middleware to wrap with Better Errors
Expand Down