psi-4ward / psitransfer

Simple open source self-hosted file sharing solution.
BSD 2-Clause "Simplified" License
1.48k stars 216 forks source link

HTTPS reverse proxy (NPM jc21) not working #182

Closed Aerya closed 1 year ago

Aerya commented 3 years ago

Hi,

I use this official Docker:

docker run -d \
--restart=always \
--name psitransfer \
-p 3007:3000 \
-v /home/aerya/mnt/test:/data \
-e PSITRANSFER_ADMIN_PASS=xx \
-e PSITRANSFER_UPLOAD_PASS=xx \
-e PSITRANSFER_DEFAULT_LANGUAGE=fr \
psitrax/psitransfer:latest

It works fine with http://ip:3007 but I can't make it work using Nginx Proxy Manager (NPM from JC21). Sub-domain with Cloudflare, SSL using DNS challenge (cert is ok).

Any tip/help would be appreciated! A.

Hobbabobba commented 3 years ago

are the psitransfer container and the npm on the same network?

JasonB73 commented 2 years ago

Has Anyone gotten HTTPS working with PSITransfer yet? Also trying NPM (v2.9.18 © 2022) I have NPM working fine by it's self but I'm getting a gateway error for the Proxy. The HTTP://Domain:8080 working for PSITtransfer for the Public space to the Docker thought the firewall. I have to use HTTPS though. Or find a different solution.

NeilJared commented 1 year ago

Hi JasonB73. I have it mounted on a Synology running DSM 7.1 and configured a reverse proxy, and works pretty smooth using https.

JasonB73 commented 1 year ago

fruizaviles, thanks for the reply. Still haven't gotten it to work in ESXi7> Photon OS4 > Docker. Any chance you can email me? Looking for any help I can. I must be missing something simply. jboard@stoddardintl.com

psi-4ward commented 1 year ago

When you enable PsiTransfer to server also HTTPS you need to forward the https-port: https://github.com/psi-4ward/psitransfer/blob/master/config.js#L18

Also, you need to access it by the right protocol - HTTPS. Browsers usually try http first when you dont explicitly type the schema: ie https://my-psitrasfer.com vs psi-transfer.com. So you should also forward the http-port. PsiTransfer should answer to an unsecure connection with an redirect if you configure forceHttps https://github.com/psi-4ward/psitransfer/blob/master/config.js#L24

PS: Most users (like me) leave the HTTPS termination (and certificate management) to some other software - for example Traefik and/or Cert-Manager.

JasonB73 commented 1 year ago

Using this in Docker to add and setup. -------------HTTPS------------- docker run -d \ --restart=always \ --name SI-Transfer-HTTPS \ -p 8080:8080 \ -p 8443:8443 \ -v /home/company/psitransfer:/data \ -e PSITRANSFER_ADMIN_PASS=xxxxxx\ -e PSITRANSFER_PORT=8080 \ -e PSITRANSFER_PORT=8443 \ -e PSITRANSFER_DEFAULTRETENTION=3600 \ -e PSITRANSFER_UPLOAD_PASS=xxxxxx\ psitrax/psitransfer:latest

I tried editing the config.js // HTTPS, set all 3 values to enable "sslPort": 8443, "sslKeyFile": enable, "sslCertFile": enable, "forceHttps": ''enable,

When I try HTTPS://ip:8443 I get a connection timed out error?

NeilJared commented 1 year ago

Hi. Try https using port 443. It is mine working for all https services. Kind regards, Frank

El mar, 18 oct 2022 18:54, JasonB73 @.***> escribió:

Using this in Docker to add and setup. -------------HTTPS------------- docker run -d --restart=always --name SI-Transfer-HTTPS -p 8080:8080 -p 8443:8443 -v /home/company/psitransfer:/data -e PSITRANSFER_ADMIN_PASS=xxxxxx -e PSITRANSFER_PORT=8080 -e PSITRANSFER_PORT=8443 -e PSITRANSFER_DEFAULTRETENTION=3600 -e PSITRANSFER_UPLOAD_PASS=xxxxxx psitrax/psitransfer:latest

I tried editing the config.js // HTTPS, set all 3 values to enable "sslPort": 8443, "sslKeyFile": enable, "sslCertFile": enable, "forceHttps": ''enable,

When I try HTTPS://ip:8443 I get a connection timed out error?

— Reply to this email directly, view it on GitHub https://github.com/psi-4ward/psitransfer/issues/182#issuecomment-1282703084, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGKIVT5T73SB3QVGUT6WTDDWD3I2XANCNFSM47P7APDQ . You are receiving this because you commented.Message ID: @.***>

psi-4ward commented 1 year ago

@fruizaviles the port doesnt matter!

@JasonB73

"sslKeyFile": enable,
"sslCertFile": enable,
"forceHttps": ''enable,

is very wrong!

forceHttps needs to be true or false and you've a " before the enable which is incorrect json/javascript

sslKeyFile, sslCertFile - you notice the File ? You've to create certificates and provide the key and the certificate(chain). I will not going to cover it here. Just google how to acquire (ie LetsEncrypt) certificates