linuxserver / docker-hedgedoc

GNU General Public License v3.0
42 stars 7 forks source link

Accessing HedgeDoc over HTTPS stops it from working #21

Closed DanielMcAssey closed 2 years ago

DanielMcAssey commented 2 years ago

linuxserver.io


Expected Behavior

When accessing via HTTPS HedgeDoc should still work

Current Behavior

When accessing via HTTPS it tries to load content over HTTP causing the Content Security Policy to trigger, blocking requests.

Steps to Reproduce

  1. Create Blank HedgeDoc server
  2. Create an NGINX reverse proxy and use a letsencrypt certificate
  3. Access hedgedoc and try to login

Environment

OS: Unraid CPU architecture: x64 How docker service was installed:

From the community apps store on Unraid

Command used to create docker container (run/create/compose/screenshot)

Not relevant

Docker logs

Not relevant

github-actions[bot] commented 2 years ago

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

meno-science commented 2 years ago

I'm seeing the same thing, and I'm also on Unraid.

[ 2021-11-16_19-32

2021-11-16_19-29 ](url)

Using a modified nginx.conf (the /socket.io/ location comes from the hedgedoc guide) 2021-11-16_19-35

meno-science commented 2 years ago

Command:

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='hedgedoc' --net='proxynet' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e HOST_HOSTNAME="HOST" -e HOST_CONTAINERNAME="hedgedoc" -e 'CMD_DOMAIN'='MY_URL' -e 'CMD_URL_ADDPORT'='false' -e 'CMD_DB_URL'='mysql://USER:PASSWORD@DATABASE_IP:3306/hedgedoc' -e 'CMD_PROTOCOL_USESSL'='true' -e 'PUID'='99' -e 'PGID'='100' -e 'UMASK'='022' -l net.unraid.docker.managed=dockerman -l net.unraid.docker.icon='https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/hedgedoc-logo.png' -v '/mnt/user/appdata/hedgedoc':'/config':'rw' 'lscr.io/linuxserver/hedgedoc'

mcking230 commented 2 years ago

@meno-science try with this environments

CMD_DOMAIN=mynotes.mydomain.com
CMD_URL_ADDPORT=true
CMD_PORT=443
CMD_PROTOCOL_USESSL=true

and change your reverse_proxy config

cpnfeeny commented 2 years ago

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='hedgedoc' --net='proxynet' -e TZ="Europe/Berlin" -e HOST_OS="Unraid" -e HOST_HOSTNAME="***f" -e HOST_CONTAINERNAME="hedgedoc" -e 'CMD_DOMAIN'='***' -e 'CMD_URL_ADDPORT'='false' -e 'CMD_DB_URL'='mysql://user:pass@mysql_location:3306/hedgedoc' -e 'CMD_PROTOCOL_USESSL'='true' -e 'DB_PORT'='3306' -e 'DB_USER'='hedgedoc' -e 'DB_PASS'='secret password' -e 'DB_NAME'='hedgedoc' -e 'PUID'='99' -e 'PGID'='100' -e 'UMASK'='022' -l net.unraid.docker.managed=dockerman -l net.unraid.docker.icon='https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/hedgedoc-logo.png' -p '3000:3000/tcp' -v '/mnt/user/appdata/hedgedoc':'/config':'rw' 'lscr.io/linuxserver/hedgedoc'

For future reference, this worked for me, in the end.

aptalca commented 2 years ago

as described in the readme, https access via reverse proxy requires setting CMD_DOMAIN to the address used, and CMD_URL_ADDPORT to false

DanielMcAssey commented 2 years ago

@aptalca please see my config below, still not working

image

I had to add CMD_PROTOCOL_USESSL=true. So I think the readme needs to be updated to include that

aptalca commented 2 years ago

Hmm, I'll have to do more tests. Last time I tested, only those two were needed.

DanielMcAssey commented 2 years ago

This issue prevents you from logging in, otherwise it's fine, I can access the homepage, just not login. Unless I put that other env variable

aptalca commented 2 years ago

Ah, gotcha, when I just tested recently, I only paid attention to all the assets on the homepage loading correctly, and created a post as a guest. I didn't try to log in.