LycheeOrg / Lychee-Docker

Docker image for Lychee
https://lycheeorg.github.io/
165 stars 56 forks source link

brand new site can't see images #176

Closed mlapaglia closed 7 months ago

mlapaglia commented 8 months ago

running docker run -p 80 lycheeorg/lychee creates a site that images can't be viewed after uploading them, looks like it's trying to get images from localhost image is there any documentation for how to get it up and running successfully?

MikeTheTux commented 8 months ago

You need to set APP_URL env variable to the IP Address

mlapaglia commented 8 months ago

what port is https on? i tried using 443 but it doesn't respond. image

ildyria commented 8 months ago

it does respond, but it all the queries you are making afterwards are blocked by the CSP. That is because you are trying to fetch http on the data. You need to set you APP_URL with the https prefix.

mlapaglia commented 8 months ago

ok switched it to the 443, the site isn't responding to 443 it still works on 80 though

docker run -d
  -e 'APP_URL'='https://192.168.1.164:4880/'
  -p '4879:80/tcp'
  -p '4880:443/tcp'

image

image

ildyria commented 8 months ago
docker run -d
  -e 'APP_URL'='http://192.168.1.164'
  -p '4879:80/tcp'
ildyria commented 8 months ago

you can't use https without setting a certificate or using a reverse proxy. Our docker image only opens port 80.

If you use a reverse proxy which takes care of https (and the certificate) and redirect then traffic to 80, then you will need to set your APP_URL to https.

MikeTheTux commented 8 months ago

You can have a look at #175

mlapaglia commented 8 months ago

Ok here is my reverse proxy settings: image

APP_URL is now https://MYDOMAIN.com/

it's still requesting http urls though image

when i try to access the site locally again it tries to use the https MYDOMAIN image

You can have a look at #175

this just seems like a bunch of workarounds? is there any documentation about using a reverse proxy? i've had it running for years but v5 has made it stop working.

MikeTheTux commented 8 months ago

this just seems like a bunch of workarounds?

I'm also just a user, who struggled with similar problems. That's the reason why I created https://github.com/LycheeOrg/Lychee-Docker/issues/175.

Did you modify /etc/nginx/nginx.conf within the container (fastcgi_param HTTPS on;)? I guess this is the missing piece.

ildyria commented 8 months ago

Did you modify /etc/nginx/nginx.conf within the container (fastcgi_param HTTPS on;)? I guess this is the missing piece.

That should not be necessary as long as the reverse proxy is forwarding https headers.

I'll try to improve the description for Apache, but I can't really do much for the nginx one as I don't have knowledge there. Furthermore, I strongly suggest to use docker compose rather than docker from cli.

mlapaglia commented 8 months ago

I can lend a hand if you can show me how to record the headers being forwarded. is there something special about lychee that makes it work different than many other docker containers i forward the same way to? could the APP_URL be omitted and the site serve up content to whatever requests it?

ildyria commented 8 months ago

FYI: https://github.com/LycheeOrg/Lychee/pull/2182 https://github.com/LycheeOrg/Lychee/pull/2181

jotka commented 8 months ago

same for me. Something is wrong with this APP_URL.

after starting with

-e APP_URL=192.168.1.4

the image URL is rendered as:

http://192.168.1.4:13380/gallery/U0Cz5MyvYH4QE9rzxIl48WS_/192.168.1.4/uploads/medium2x/dd/3e/a8aef076afeda630245b0b0e1b18.jpg

which renders 404 NotFoundHttpException

172.17.0.1 - - [09/Jan/2024:18:08:57 +0100] "GET /192.168.1.4:13380/uploads/medium/dd/3e/a8aef076afeda630245b0b0e1b18.jpg HTTP/1.1" 404 48505 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15" "-" 172.17.0.1 - - [09/Jan/2024:18:08:57 +0100] "GET /192.168.1.4:13380/uploads/small2x/dd/3e/a8aef076afeda630245b0b0e1b18.jpg HTTP/1.1" 404 48492 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15" "-" 172.17.0.1 - - [09/Jan/2024:18:08:57 +0100] "GET /192.168.1.4:13380/uploads/small2x/18/43/cd5f57bed44befc5b50bfa63fb9a.jpg HTTP/1.1" 404 48495 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15" "-"

jotka commented 8 months ago

ok, adding http:// helps:

-e APP_URL=http://192.168.1.4:13380 \

but do we need this env after all? what about if I'm serving the app on multiple different domains?

ildyria commented 7 months ago

Should be resolved with latest builds.