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

Support for virtual hosts #656

Closed
chiahrens opened this issue Mar 11, 2013 · 4 comments
Closed

Support for virtual hosts #656

chiahrens opened this issue Mar 11, 2013 · 4 comments
Labels
bug Bug or defect support Questions, discussions, and general support
Milestone

Comments

@chiahrens
Copy link

Is there support for virtual hosts? With connect, we were able to support virtual hosts by implementing our own routes. Thanks.

@geek
Copy link
Member

geek commented Mar 11, 2013

A route does have a vhost option that can restrict the route to an individual host or an array of hosts. There are also a few examples of using it in the router tests.

@geek geek closed this as completed Mar 11, 2013
@chiahrens
Copy link
Author

Awesome. Thanks.

@chiahrens
Copy link
Author

Ok, so one tiny little thing. The vhost is matched based on request.raw.req.headers.host, which ends up being hostname:port in router.js:route(request). Which is kind of inconvenient because you typically don't associate the port with the path or even the virtual host. The workaround I have in place is to just add ":PORT" to the end of the vhost when I set the route, but it would nice if hapi could just associate the path regardless of the port. Otherwise, it works great. Thanks.

@hueniverse hueniverse reopened this Apr 2, 2013
@chiahrens
Copy link
Author

Awesome! Thanks for the quick fix!

jmonster pushed a commit to jmonster/hapi that referenced this issue Feb 10, 2014
@lock lock bot locked as resolved and limited conversation to collaborators Jan 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect support Questions, discussions, and general support
Projects
None yet
Development

No branches or pull requests

3 participants