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

redirect:set generates invalid config in a fresh 0.6.5 install #9

Closed IlyaSemenov closed 8 years ago

IlyaSemenov commented 8 years ago

On a fresh Dokku 0.6.5 install, dokku redirect:set app www.app.com app.com generates invalid nginx config:

server {
  listen      [::]:;
  listen      ;
  server_name www.app.com;
  return 301 $scheme://app.com$request_uri;
}

which gives this nginx error:

nginx: [emerg] invalid port in "[::]:" of the "listen" directive in /home/dokku/app/nginx.conf:38
nginx: configuration file /etc/nginx/nginx.conf test failed

This is because in redirect.conf you rely on NGINX_PORT, and starting from Dokku 0.6 you need to look up PROXY_PORT_MAP for the port (see how the core plugin does that at https://github.com/dokku/dokku/blob/master/plugins/nginx-vhosts/templates/nginx.conf.sigil)