Skip to content

Allow subdomains to work with no SERVER_NAME #905

@yannk

Description

@yannk

Would you be open to a patch allowing the use of subdomain routing with no SERVER_NAME pre-configured?

The motivation is to allow multiple domains to match a request, just like it does when SERVER_NAME is None, while still benefiting from the nice subdomain matcher. This is particularly useful in DEV to be able to develop on machine.local but also tunnel the instance to a vpn, and use things like xip.io (which all change the host).

The change would probably be mostly focused on create_url_adapter(). I imagine a configuration variable switching a different logic on for this function: it would look for subdomains and deduce the server_name which is the reverse of what's going on today.
The list of subdomains could come from the configuration I suppose, or better be deduced from the compilation of the routes.

  1. What do you think of this idea?
  2. If you are opposed to it, what alternative approach do you suggest instead?
  3. If you are not opposed to it, how do you think the implementation should look like?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions