dokku / dokku-redirect

A plugin for dokku that gives the ability to set simple redirects for an application
MIT License
106 stars 9 forks source link

Nginx gives warnings when configuring a redirect AND domain for an alias domain. #25

Open cooperaj opened 5 years ago

cooperaj commented 5 years ago

Suppose you have two domains;

example.io and example.com

and you want to direct all traffic to example.io such that all the following is true;

example.com is just an alias in that you want it there to capture traffic but you want your visitors to end up on example.io. When you throw letsencrypt into the mix you end up with Nginx throwing warnings as the required domains interfere with the redirects that this plugin puts in place.

To setup letsencrypt for the https://(www)?\.example\.(io|com) you need to add the domains via the dokku domains functionality. You'll also need to add redirects via dokku redirect but when you do this Nginx starts warning about duplicate server names.

nginx: [warn] conflicting server name "www.example.io" on [::]:80, ignored
nginx: [warn] conflicting server name "www.example.com" on [::]:80, ignored
nginx: [warn] conflicting server name "example.com" on [::]:80, ignored
nginx: [warn] conflicting server name "www.example.io" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:80, ignored
nginx: [warn] conflicting server name "www.example.io" on [::]:443, ignored
nginx: [warn] conflicting server name "www.example.com" on [::]:443, ignored
nginx: [warn] conflicting server name "example.com" on [::]:443, ignored
nginx: [warn] conflicting server name "www.example.io" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "www.example.com" on 0.0.0.0:443, ignored
nginx: [warn] conflicting server name "example.com" on 0.0.0.0:443, ignored
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

@josegonzalez suggests that it could be possible to inject domains from this redirect plugin into the letsencrypt domain list so so that it not necessary to add them via dokku domains