-
Notifications
You must be signed in to change notification settings - Fork 1
Add URL rewriting in Rails #435
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
base: main
Are you sure you want to change the base?
Conversation
coorasse
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we do this on the app layer and not cloudflare?
| if (app_host = ENV["APP_HOST"]).present? | ||
| match "*path", constraints: ->(req) { req.host != app_host && !req.path.start_with?("/.well-known/") }, | ||
| to: redirect { |_params, req| "https://#{app_host}#{req.fullpath}" }, via: :all | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| if (app_host = ENV["APP_HOST"]).present? | |
| match "*path", constraints: ->(req) { req.host != app_host && !req.path.start_with?("/.well-known/") }, | |
| to: redirect { |_params, req| "https://#{app_host}#{req.fullpath}" }, via: :all | |
| end | |
| if (canonical_host = ENV["CANONICAL_HOST"]).present? | |
| match "*path", constraints: ->(req) { req.host != canonical_host && !req.path.start_with?("/.well-known/") }, | |
| to: redirect { |_params, req| "https://#{canonical_host}#{req.fullpath}" }, via: :all | |
| end |
I'd rather use a separate ENV variable here. APP_HOST is in most cases also set in staging apps AFAIK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't that what we want? If the env is set in staging/develop, then the deplo.io host redirects to renuoapp.
TICKET-23056
Discussed with @sislr