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

Build/fix no prefix #1089

Merged
merged 4 commits into from Nov 4, 2022
Merged

Build/fix no prefix #1089

merged 4 commits into from Nov 4, 2022

Conversation

conectado
Copy link
Collaborator

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 the EXTERNAL_URL it'd cause a bug where the ip or host was taken as a path instead of host when using URI.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 the https:// .

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
Copy link
Member

@jamilbk jamilbk Nov 3, 2022

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?

Copy link
Collaborator Author

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

Copy link
Member

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.

Copy link
Collaborator Author

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

@coveralls
Copy link

coveralls commented Nov 3, 2022

Pull Request Test Coverage Report for Build 9ee2a9120174389ddc768d7a0ceeeca9fba63877-PR-1089

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.08%) to 66.055%

Totals Coverage Status
Change from base Build 368ff3e55c6193ce4d2a0e1749c2a9a84a9bcdeb: 0.08%
Covered Lines: 1152
Relevant Lines: 1744

💛 - 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
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
Copy link
Member

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.

@jamilbk jamilbk merged commit 029891c into master Nov 4, 2022
@jamilbk jamilbk deleted the build/fix-no-prefix branch November 4, 2022 02:36
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.

Asset paths not generated correctly for schemeless external urls
3 participants