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

Ensure default URL host never has a trailing / #503

Merged
merged 1 commit into from
Mar 11, 2019

Conversation

Mr0grog
Copy link
Member

@Mr0grog Mr0grog commented Mar 3, 2019

A while back I did this funky thing where the environment variable that controls the default host in all the URL helpers is called HOST_URL, which implies it’s a URL, and then stuck things like https://api.monitoring.envirodatagov.org/ in it, which, well, is a URL, but definitely not a host, and further confused things.

It turns out Rails will happily use the scheme provided in there anyway (!), so that was really convenient. But what it failed to do was handle the trailing slash—an absolute path also starts with one, so you wind up getting URLs like https://api.monitoring.envirodatagov.org//whatever (not the double slash at the start of the path). While we should have more correct configuration, we could also gracefully handle incorrect configuration by removing trailing slashes, which is what this PR does.

Fixes #301.

@Mr0grog Mr0grog merged commit 1b43d71 into master Mar 11, 2019
@Mr0grog Mr0grog deleted the 301-hosts-arent-urls-so-this-is-all-a-bit-wacky branch March 11, 2019 05:20
Mr0grog added a commit that referenced this pull request Mar 13, 2019
Mr0grog added a commit to edgi-govdata-archiving/web-monitoring-ops that referenced this pull request Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant