Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add subdomain_matching param to Map #3005

Open
davidism opened this issue Nov 11, 2024 · 2 comments · May be fixed by #3006
Open

add subdomain_matching param to Map #3005

davidism opened this issue Nov 11, 2024 · 2 comments · May be fixed by #3006
Assignees
Milestone

Comments

@davidism
Copy link
Member

If server_name is passed to Map.bind_from_environ, and a subdomain is not passed in (as usually it's not possible to know it), it will try to detect the subdomain by removing server_name as a suffix from host. This restricts routing to only the configured server_name, even if we don't have any subdomain-based routing rules.

Move Flask's subdomain_matching param into Map (where host_matching is already). bind_to_environ should not extract a subdomain unless it's enabled.

@davidism davidism added this to the 3.2.0 milestone Nov 11, 2024
@davidism
Copy link
Member Author

server_name should also be ignored if host_matching is enabled, it should only be used for subdomain_matching.

@davidism
Copy link
Member Author

davidism commented Nov 12, 2024

default_subdomain should be used if it's set and server_name is not a suffix of Host. Currently "<invalid>" is always used, and I'm not sure this is correct since it causes wildcard subdomain="<name>" rules to still match, even though the comment indicates it should 404. So maybe evaluate removing "<invalid>" as well.

Or maybe it shouldn't. Maybe knowing it's not a valid subdomain, rather than using the default, is more useful? "<invalid>" isn't mentioned anywhere in the docs, and is only present in three tests that don't actually test routing to it, only that it is what is set on the adapter.

@davidism davidism linked a pull request Nov 12, 2024 that will close this issue
@davidism davidism self-assigned this Nov 12, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant