From b1df26a4dcb7e22e6848a49cfa0c60b0f79ccd70 Mon Sep 17 00:00:00 2001 From: Erica Portnoy Date: Thu, 11 Jan 2018 14:44:39 -0800 Subject: [PATCH] continue to return None from choose_redirect_vhost when create_if_no_match is False --- certbot-nginx/certbot_nginx/configurator.py | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/certbot-nginx/certbot_nginx/configurator.py b/certbot-nginx/certbot_nginx/configurator.py index 89e67dd04..a77cf2bc3 100644 --- a/certbot-nginx/certbot_nginx/configurator.py +++ b/certbot-nginx/certbot_nginx/configurator.py @@ -392,17 +392,8 @@ class NginxConfigurator(common.Installer): """ matches = self._get_redirect_ranked_matches(target_name, port) vhost = self._select_best_name_match(matches) - if not vhost: - if create_if_no_match: - vhost = self._vhost_from_duplicated_default(target_name) - else: - # No matches. Raise a misconfiguration error. - raise errors.MisconfigurationError( - ("Cannot find a VirtualHost matching domain %s. " - "In order for Certbot to correctly perform the challenge " - "please add a corresponding server_name directive to your " - "nginx configuration: " - "https://nginx.org/en/docs/http/server_names.html") % (target_name)) + if not vhost and create_if_no_match: + vhost = self._vhost_from_duplicated_default(target_name) return vhost def _get_redirect_ranked_matches(self, target_name, port):