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

Fix port issue on host-based routing #1322

Merged
merged 9 commits into from
Nov 25, 2021

Conversation

WhiteApfel
Copy link
Contributor

@WhiteApfel WhiteApfel commented Oct 26, 2021

Host.host_regex is only used to check "Host" header: (routing.py:432)

host = headers.get("host", "").split(":")[0]
match = self.host_regex.match(host)

However, when generating Host.host_regex, the port remained: (routing.py:149)

path_regex += re.escape(path[idx:]) + "$"

I added one small fix. Now the port is also removed from Host.host_regex

UPD: Before this fix, the code from #1317 example returned Not found, and after Hello World

@WhiteApfel WhiteApfel changed the title Fix port issue on host-based routing (#1317) Fix port issue on host-based routing Oct 26, 2021
@aminalaee aminalaee requested a review from a team October 26, 2021 07:38
@WhiteApfel
Copy link
Contributor Author

If you accept this change, then we will need to update info in the documentation (I added a note in #1313). I can commit to this pull request, or create a new one. What should I do?

@PrettyWood
Copy link
Member

Hey thanks for that. Surely a unit test can be added!

Copy link
Contributor

@parz3val parz3val left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@aminalaee aminalaee linked an issue Oct 27, 2021 that may be closed by this pull request
2 tasks
@aminalaee
Copy link
Member

If you accept this change, then we will need to update info in the documentation (I added a note in #1313). I can commit to this pull request, or create a new one. What should I do?

Yes, I think we can update the doc in the same PR since they are related.

@WhiteApfel
Copy link
Contributor Author

I think that in general the pull request is ready. But I'm not sure about the quality of the wording in the note

@WhiteApfel
Copy link
Contributor Author

These errors are not caused by code, is it?

@aminalaee
Copy link
Member

These errors are not caused by code, is it?

Probably Github's issue:

GitHub Actions has encountered an internal error when running your job.

@Kludex
Copy link
Member

Kludex commented Nov 5, 2021

It looks like is running now. I've relaunch the pipeline.

Copy link
Member

@aminalaee aminalaee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thank you for this.

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.

🐛 Different Host behavior for setting host argument and getting Host header
5 participants