mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Fix bug that stopped nginx from finding new server block for redirect (#5198)
* fix bug that stopped nginx from finding new server block for redirect * add regression test
This commit is contained in:
parent
3c1dafa9e9
commit
e2ab940ac0
2 changed files with 11 additions and 1 deletions
|
|
@ -266,7 +266,10 @@ class NginxConfigurator(common.Installer):
|
|||
self.new_vhost.names = set()
|
||||
|
||||
self.new_vhost.names.add(domain)
|
||||
name_block = [['\n ', 'server_name', ' ', ' '.join(self.new_vhost.names)]]
|
||||
name_block = [['\n ', 'server_name']]
|
||||
for name in self.new_vhost.names:
|
||||
name_block[0].append(' ')
|
||||
name_block[0].append(name)
|
||||
self.parser.add_server_directives(self.new_vhost, name_block, replace=True)
|
||||
return self.new_vhost
|
||||
|
||||
|
|
|
|||
|
|
@ -676,6 +676,13 @@ class NginxConfiguratorTest(util.NginxTest):
|
|||
"example/chain.pem",
|
||||
"example/fullchain.pem")
|
||||
|
||||
self.config.deploy_cert(
|
||||
"nomatch.com",
|
||||
"example/cert.pem",
|
||||
"example/key.pem",
|
||||
"example/chain.pem",
|
||||
"example/fullchain.pem")
|
||||
|
||||
self.config.enhance("www.nomatch.com", "redirect")
|
||||
|
||||
self.config.save()
|
||||
|
|
|
|||
Loading…
Reference in a new issue