0

I am using the dockercloud/haproxy image to proxy and balance incoming http requests. The docker container should listen to port 443 and 80 (-> 443).

I am using Stackfiles and I've been redirecting the path /api with VIRTUAL_HOST=*/api/*.

Adding SSL support, I am not sure if I have to replace line breaks on the DEFAULT_SSL_CERT param. For the http -> https redirect I am using the FORCE_SSL param.

What config should I use for the forward? I am on the right way with this config?

This is my current stackfile:

api:
  autoredeploy: true
  environment:
    - "VIRTUAL_HOST=*/api/*"
    - "VIRTUAL_HOST_WEIGHT=1"
    - "FORCE_SSL=yes"
  image: "anaibol/webapp-api:latest"
web:
  autoredeploy: true
  environment:
    - "VIRTUAL_HOST=*"
    - "VIRTUAL_HOST_WEIGHT=0"
    - "FORCE_SSL=yes"
  image: "anaibol/webapp:latest"
  links:
    - api
lb:
  image: "dockercloud/haproxy:latest"
  links:
    - api
    - web
  ports:
    - "443:443"
    - "80:80"
  roles:
    - global
  environment:
    - "DEFAULT_SSL_CERT=-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----"
techraf
  • 4,243
  • 8
  • 29
  • 44
Anibal
  • 103
  • 1
  • 5

1 Answers1

0

What worked for me was setting VIRTUAL_HOST like so:

VIRTUAL_HOST=*/api*, https://*/api*

Also DEFAULT_SSL_CERT line breaks are fine.

B Λ R T
  • 16
  • 3