SSL and Multisite redirecting to wrong SSL domain


(Dylan R. E. Moonfire) #1

Salutations.

I was trying to implement the directions from here. I added the follow sections into my app.yml file and did a sudo ./launcher rebuild app.

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/sshd.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.ssl.template.yml"             # Let's Encrypt
  - "templates/web.letsencrypt.ssl.template.yml" # Let's Encrypt

hooks:
  after_ssl:
    - replace:
        filename: "/etc/runit/1.d/letsencrypt"
        from: /no 4096/
        to: |
          discuss.domain2.com,discuss.domain3.com 4096

    - replace:
        filename: "/etc/nginx/conf.d/discourse.conf"
        from: /rewrite \^ https.+/
        to: |
          return 301 https://$host$request_uri;

    - replace:
        filename: "/etc/nginx/conf.d/discourse.conf"
        from: /gzip on;[^\}]+\}/m
        to: |
          gzip on;

It worked great on http://discuss.domain1.com/ going to the SSL site, but when I go to http://discuss.domain2.com it redirects to https://discuss.domain1.com/ instead of domain2 like I expected. What am I doing wrong?