monicahq / docker

docker image of Monica
https://hub.docker.com/_/monica/
GNU General Public License v2.0
203 stars 61 forks source link

SSL Termination causing issues fetching content #116

Closed henriquevcosta closed 1 year ago

henriquevcosta commented 2 years ago

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 commented 2 years ago

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

I set:

Hope this helps others

katiyar-rahul commented 1 year ago

Only setting APP_ENV to "production" works for me.

asbiin commented 1 year ago

Closing this one now, thank you.