Should a link to an uploaded file redirect to /uploads/<hash>/filename.ext, or serve the file directly? #28
Labels
No Label
bug
feature
good-beginner-bug
needs-test
question
wontfix
No Milestone
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: electricdusk/rushlink#28
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Currently,
https://hashru.link/PVwZ
, which is a file uploaded with-F'file=@filename.ext'
, redirects tohttps://hashru.link/uploads/ef9841a5d7fb4917ab7dea052329e5f4/dancing-baby.gif
, which serves the file.Alternatively, we could serve the file directly, keeping
https://hashru.link/PVwZ
in the address bar of the user's browser.The reason I chose for this design is to allow the administrator to easily delegate the serving of the files to the webserver, instead of the Go process. However, to do this properly, we really want to separate the paths, s.t. you can tell the webserver to handle/cache the files immediately.
Closing as "question answered". Feel free to reopen if something is still unclear.
For future reference, this is the way to implement this in nginx (the
X-Accel-Redirect
header): https://www.nginx.com/resources/wiki/start/topics/examples/x-accel/I decided that we should implement this, mainly because CURL does not follow redirects by default.