docker icon indicating copy to clipboard operation
docker copied to clipboard

SSL Termination causing issues fetching content

Open henriquevcosta opened this issue 2 years ago • 1 comments

I have Monica running in a docker container with a Traefik container performing the SSL termination. Assume my domain is potato.com in the description below.

  1. I have configured Monica's container with the Traefik rule to use the hostname "monica.potato.com". Traefik will do HTTPs and then hit Monica's container on :80
  2. If I hit https://monica.potato.com I am redirected to the dashboard page, and am able to create the first user. However, the style's all broken and the form submission generates a browser warning saying it's unsafe
  3. Opening the browser console shows that a few resources (JS and CSS) have been blocked because they are trying to be fetched from http://monica.potato.com and indeed if I open the source of the dashboard page I see the below
 <link rel="stylesheet" href="http://monica.potato.com/css/app-ltr.css?id=523470c277b241ddce13">

Is there something else that needs to be configured in the container for this to work well? Maybe something that lets apache know that although what's reaching it is an http request it should use https URLs? I don't think it makes sense to be doing body rewrites in Traefik to address this, but I'm very ignorant of PHP+Apache so I have no idea what I'd need to get this working. Happy to provide more info if needed.

henriquevcosta avatar Oct 08 '22 23:10 henriquevcosta

OK after setting some env variables it seems to work, maybe they need to be in the documentation.

I set:

  • APP_URL to my external URL (https://monica.potato.com)
  • APP_ENV to "production"
  • APP_FORCE_URL to "true"

Hope this helps others

henriquevcosta avatar Oct 09 '22 00:10 henriquevcosta

Only setting APP_ENV to "production" works for me.

katiyar-rahul avatar Jan 24 '23 04:01 katiyar-rahul

Closing this one now, thank you.

asbiin avatar Jan 30 '23 16:01 asbiin