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

vhost that binds to 'any host' -> no server_name #506

Closed
gdhbashton opened this issue Nov 21, 2014 · 1 comment
Closed

vhost that binds to 'any host' -> no server_name #506

gdhbashton opened this issue Nov 21, 2014 · 1 comment
Labels
enhancement New feature or request

Comments

@gdhbashton
Copy link

Hi,

From looking at templates/vhost/vhost_header.erb, server_host will always be set in any vhost.

Is it possible to make this optional for the case where a client does not send any Host: header (e.g. a load-balancer check), hence nginx will use the vhost as a 'fallthrough'. This would also be useful for "301 redirect everything to www.canonicaldomain.com"

Cheers,
Gavin.

@3flex 3flex added the enhancement New feature or request label Apr 13, 2015
@wyardley
Copy link
Collaborator

wyardley commented Oct 8, 2016

This can be accomplished by using '' as one of the attributes of 'server_name'. That is, you can use '' only as a fallback, or include '_' in server_name array for whichever vhost you want to be default.

This should probably be better documented, but it does work (and it's the convention nginx already uses / documents).

@wyardley wyardley closed this as completed Oct 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants