szabodanika / microbin

A secure, configurable file-sharing and URL shortening web app written in Rust.
https://microbin.eu
BSD 3-Clause "New" or "Revised" License
2.66k stars 167 forks source link

MICROBIN_PUBLIC_PATH not working correctly #248

Open azertylr opened 8 months ago

azertylr commented 8 months ago

Hello,

It seems that MICROBIN_PUBLIC_PATH is not working correctly.

To Reproduce I ran microbin on docker, with MICROBIN_PUBLIC_PATH=https://mydomain.tld/microbin/

behind a nginx reverse proxy:

location /microbin {
    return 301 $scheme://$host/microbin/;
}
location /microbin/ {
    set $upstream_app microbin;
    set $upstream_port 8080;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port;
    rewrite /microbin(.*) $1 break;
}

and uploading file was not working, so I had to add this to my nginx config:

`location /upload {
    set $upstream_app microbin;
    set $upstream_port 8080;
    set $upstream_proto http;
    proxy_pass $upstream_proto://$upstream_app:$upstream_port/upload;
}`

and also the "?" which should redirect to /microbin/guide, does redirect to /guide

phuslu commented 7 months ago

Same issue , I suppose the root cause is here https://github.com/szabodanika/microbin/blob/b8a0c5490d681550d982ad02d67a1aaa0897f503/templates/index.html#L284