[Reverse Proxy] Can't upload image

My version of HedgeDoc is: 1.8.2
Using Docker with nginx reverse proxy
What I expected to happen:

Upload images.

What actually happened:

Can’t Upload images: Uploading file…_fyk5d7ljx

2021-07-08T08:24:59.563Z info: 	deserializeUser: 3bb5fb0...
(node:35) UnhandledPromiseRejectionWarning: TypeError [ERR_INVALID_URL]: Invalid URL: /uploads/
    at onParseError (internal/url.js:258:9)
    at new URL (internal/url.js:334:5)
    at new URL (internal/url.js:331:22)
    at Object.exports.uploadImage (/hedgedoc/lib/web/imageRouter/filesystem.js:28:19)
    at /hedgedoc/lib/web/imageRouter/index.js:96:22
(node:35) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:35) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I already tried:

Followed this https://docs.hedgedoc.org/guides/reverse-proxy/#reverse-proxy-config, but when i put this variable: CMD_DOMAIN, i got errors:


When i add CMD_PATH=/var/run/hedgedoc.sock, i got this error: listen EACCES: permission denied /var/run/hedgedoc.sock

Hi @riadabdel!

In addition to setting CMD_DOMAIN, if your reverse proxy terminates TLS (which it looks like it does), you also need to set CMD_PROTOCOL_USESSL to true. This tells HedgeDoc to use https in the URLs. Please ensure you set this variable.

You probably should not use CMD_DOMAIN. It is only used in a very specific reverse proxy setup using sockets.

Hi @davidmehren :slight_smile:
Yes i use this variable CMD_PROTOCOL_USESSL and it’s already set to True.
For now i stopped using CMD_DOMAIN and its work i can access to my docs, but i just can’t upload images, see error at the top.