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

default server for ssl #105

Closed
Jas2Ma opened this issue Feb 22, 2015 · 5 comments
Closed

default server for ssl #105

Jas2Ma opened this issue Feb 22, 2015 · 5 comments
Labels
kind/bug Issue reporting a bug

Comments

@Jas2Ma
Copy link

Jas2Ma commented Feb 22, 2015

If there are ssl-servers defined and one is requesting a non defined server, the request will be send to the first ssl server.

I change the nginx.tmpl on my own now, but I think there should be a possibility to set a standard ssl-server like you defined it for http/80?

@jwilder jwilder added the kind/bug Issue reporting a bug label Mar 4, 2015
@jwilder
Copy link
Collaborator

jwilder commented Mar 4, 2015

This might be a issue in that the default SSL server block does not have a default_server directive here: https://github.com/jwilder/nginx-proxy/blob/master/nginx.tmpl#L142

See https://github.com/jwilder/nginx-proxy#how-ssl-support-works

@Jas2Ma
Copy link
Author

Jas2Ma commented Mar 4, 2015

There is no default SSL server block, like it is for non-ssl. That's because one needs the right certificates for the requested domain.

Maybe there should be one garbage default server per domain registered for use with ssl by env .

@chschu
Copy link

chschu commented Jun 11, 2015

A fix for this would be really nice, because landing on the wrong virtual host when restarting a container (or using the server's IP address) is really confusing.

What about having a _default.crt and _default.key in the certs volume, and a default SSL vhost using those files and always returning HTTP 503?

Edit: The template already uses some default.crt and default.key, but that seems to be the fallback if no certificate is found for a vhost.

@rsynnest
Copy link

rsynnest commented Mar 1, 2018

As mentioned there is still no default SSL block to catch invalid SSL vhosts.
@kamermans published a block in this comment which you can place as your first server block in nginx.tmpl, and will reply with a 444 for any undefined vhosts served over SSL. Note his hardcoded domain in the crt + key files. You can use any valid crt+key file here, since the site will not be served anyway, but nginx will not serve the block if those files are invalid. It would make sense to add a unknownvhost.crt and unknownvhost.key and a default SSL block to the default nginx.tmpl, I can think of no reason not to have this, and it is a headache to troubleshoot.

@buchdag
Copy link
Member

buchdag commented May 10, 2023

This was fixed in #2186

@buchdag buchdag closed this as completed May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Issue reporting a bug
Projects
None yet
Development

No branches or pull requests

5 participants