docker and jwilder/nginx-proxy http/https issue

falinsky picture falinsky · Jul 7, 2015 · Viewed 7.3k times · Source

I'm using docker on osx via boot2docker.

I have 2 hosts: site1.loc.test.com and site2.loc.test.com pointed to ip address of docker host.

Both should be available via 80 and 443 ports.

So I'm using jwilder/nginx-proxy for reverse proxy purposes.

But in fact when I'm running all of them via docker-compose every time I try to open via 80 port I get redirect to 443 (301 Moved Permanently).

May be I've missed something in jwilder/nginx-proxy configuration?

docker-compose.yml

proxy:
  image: jwilder/nginx-proxy
  volumes:
    - /var/run/docker.sock:/tmp/docker.sock:ro
    - certs:/etc/nginx/certs
  ports:
    - "80:80"
    - "443:443"

site1:
  image: httpd:2.4
  volumes:
    - site1:/usr/local/apache2/htdocs
  environment:
    VIRTUAL_HOST: site1.loc.test.com
  expose:
    - "80"

site2:
  image: httpd:2.4
  volumes:
    - site2:/usr/local/apache2/htdocs
  environment:
    VIRTUAL_HOST: site2.loc.test.com
  expose:
    - "80"

Answer

tworabbits picture tworabbits · Jun 11, 2016

Just to keep this topic up to date, the jwilder/nginx-proxy meanwhile introduced a flag for that: HTTPS_METHOD=noredirect; To be set as environment variable.

Further reading on github