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

Review host matching behaviour #56

Closed
itowlson opened this issue May 31, 2021 · 6 comments
Closed

Review host matching behaviour #56

itowlson opened this issue May 31, 2021 · 6 comments
Assignees

Comments

@itowlson
Copy link
Contributor

I had a modules.toml that I assumed would not care about where it was served from - it specified routes and handlers but no hosting.

I ran my WAGI server on localhost:32768 and pointed it at this modules.toml. The routes failed to load, as far as I can tell because they did not match the default_host of localhost:3000.

Am I misunderstanding? Is this expected behaviour? It surprised the heck out of me.

On the plus side, it did give us much better tracing of the handler mapping logic.

@itowlson
Copy link
Contributor Author

Relevant logs (using logging PR):

[2021-05-31T01:46:26Z TRACE wagi] Processing request to /
[2021-05-31T01:46:26Z DEBUG wagi] Module::handler_for_host_path: host=localhost:32768, url_fragment=/
[2021-05-31T01:46:26Z TRACE wagi] Module::handler_for_host_path: trying route host=None, path/
[2021-05-31T01:46:26Z TRACE wagi] Module::handler_for_host_path: default host localhost:3000 did not match
[2021-05-31T01:46:26Z ERROR wagi] error: No handler for //localhost:32768/

@itowlson
Copy link
Contributor Author

itowlson commented Jun 1, 2021

If we feel it's important to have a host match, could we have a command line arg similar to the --listen arg, that says where host-agnostic modules or bindles should be considered to be hosted?

@technosophos
Copy link
Contributor

The default_host setting in modules.toml is for this. But I have no objection to doing a CLI argument that specifies one. Would the CLI argument override the one defined in modules.toml or vice versa?

@itowlson
Copy link
Contributor Author

itowlson commented Jun 1, 2021

The CLI would have to override I think. The issuer of the CLI command would know where they told it to listen.

Basically if I create a bindle for my application, my bindle should NOT have to know where my users are going to serve it.

@technosophos
Copy link
Contributor

Related to #58

Also, we did add a --default-host flag this week.

@technosophos
Copy link
Contributor

Closed by #72

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

No branches or pull requests

2 participants