HaschekSolutions / pictshare

:camera: PictShare is an open source image, mp4, pastebin hosting service with a simple resizing and upload API that you can host yourself. :rice_scene:
https://www.pictshare.net
Apache License 2.0
819 stars 123 forks source link

Pictshare doesn't work with docker and nginx proxy_pass #95

Closed dessalines closed 4 years ago

dessalines commented 4 years ago

Use case: I want both pictshare, and other services running on the same box, at the same domain, so use nginx proxy_pass.

I'm running the pictshare docker (at a specific port) which works well, but for some reason, if the nginx location that isn't at the top domain, it doesn't work.

Doesn't work:

    location /pictshare/ {
      proxy_pass http://0.0.0.0:8537;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

Works:

    location / {
      proxy_pass http://0.0.0.0:8537;
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
dessalines commented 4 years ago

Okay I half figured this out, but the css and such are still all served at the top level, and wrong, but at least upload.php, and the share urls are correctly routed.

proxy_pass needs a slash after it:

proxy_pass http://0.0.0.0:8537/;

dessalines commented 4 years ago

Another really bad issue: when using proxy_pass, it can't serve mp4s correctly. I played with it for 3+ hours and couldn't get it working.

error in web console: HTTP “Content-Type” of “text/html” is not supported. Load of media resource http://test.lemmy.com/pictshare/hovz5z.mp4 failed.

I tried overwriting the content-type of all mp4s served, but unfortunately it still had errors.

dessalines commented 4 years ago

Wait nevermind, I figured out that one. The videos are actually at url/raw, unlike the images.