mkaczanowski / pastebin

Simple, fast, standalone pastebin service
MIT License
155 stars 27 forks source link

URI prefix not appended to returned URL #8

Closed Seednode closed 3 years ago

Seednode commented 3 years ago

Hello,

When I specify a URI prefix with --uri-prefix, the URLs returned upon a successful paste don't seem to include that prefix.

For example, I would like to place the service behind my reverse proxy, at https://my.domain.tld/paste/. I specified --uri https://my.domain.tld and --uri-prefix /paste, using the latest mkaczanowski/pastebin Docker image (last updated 6 days ago). I can access the site as expected at https://my.domain.tld/paste, and can submit a paste. However, the returned paste URL is just https://my.domain.tld/<slug>, versus the expected https://my.domain.tld/paste/<slug>.

Am I misunderstanding the use of that argument, or is the expected behavior for the URI prefix to be included in the returned URL?

Thank you for your time.

mkaczanowski commented 3 years ago

Hey, yeah it's a bit unclear and I'll update the README... What you can do is:

"--port=10000", "--address=0.0.0.0", "--uri-prefix=/pastebin", "--uri=http://your-domain.com/pastebin", "--db=/var/lib/pastebin/pastebin.db"

--uri-prefix prefixes all the URLs in the HTML template --uri is the address returned in the pastebin URL after you create a new paste

In theory, we could simplify this by parsing the --uri, so I think I can remove the --uri-prefix flag iirc

Seednode commented 3 years ago

I've updated it following your recommendation, and it now works exactly as expected. Thanks for the quick reply, and the project!