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
Build/fix no prefix #1089
Build/fix no prefix #1089
Conversation
apps/fz_common/lib/fz_net.ex
Outdated
def to_complete_url(str) when is_binary(str) do | ||
case URI.parse(str) do | ||
%{host: nil, scheme: nil} -> "https://" <> str | ||
%{scheme: nil} -> "https" <> str |
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.
Out of curiosity, when does this happen?
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.
In an edge case a user types //hostname
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.
I see -- maybe we shouldn't boot up if EXTERNAL_URL
is invalid.
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.
Oh just did some testing, caddy doesn't support that so will remove it
Pull Request Test Coverage Report for Build 9ee2a9120174389ddc768d7a0ceeeca9fba63877-PR-1089
💛 - Coveralls |
* Fix schemeless external URLs; error on invalid ones * use different dockerfile for linux vs non-linux * Use conditional EXTERNAL_URL defaults * suppress empty warning * postgres volume location * Use inline Caddyfile
apps/fz_common/lib/fz_net.ex
Outdated
def to_complete_url(str) when is_binary(str) do | ||
case URI.parse(str) do | ||
%{host: nil, scheme: nil} -> "https://" <> str | ||
%{scheme: nil} -> "https" <> str |
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.
I see -- maybe we shouldn't boot up if EXTERNAL_URL
is invalid.
Fixes #1086 #1073
For #1073 the problem was docker doing dnat changing the destination IP and without a HOST header that would cause a cert problem (No cert for the dnatted IP) and a no site route (the route was generated for the original destination IP not the dnatted one). The fix was to put the container in
network_mode: "host"
so no dnat ocurred.For #1086 the the problem was that if you didn't add
https://
to theEXTERNAL_URL
it'd cause a bug where theip
orhost
was taken as a path instead ofhost
when usingURI.parse
which in turn would cause the Route helpers to generate the static routes incorrectly. The solution is trying to detect if it's a correctly generated url and if not add thehttps://
.