Should a link to an uploaded file redirect to /uploads/<hash>/filename.ext, or serve the file directly? #28

Closed
opened 2019-12-13 15:04:13 +01:00 by minnozz · 4 comments
Collaborator

Currently, https://hashru.link/PVwZ, which is a file uploaded with -F'file=@filename.ext', redirects to https://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.

Currently, `https://hashru.link/PVwZ`, which is a file uploaded with `-F'file=@filename.ext'`, redirects to `https://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.
Owner

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.

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.
electricdusk added the
question
label 2019-12-13 16:57:16 +01:00
Owner

Closing as "question answered". Feel free to reopen if something is still unclear.

Closing as "question answered". Feel free to reopen if something is still unclear.
Author
Collaborator

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/

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/
electricdusk added the
feature
label 2019-12-19 22:34:22 +01:00
Owner

I decided that we should implement this, mainly because CURL does not follow redirects by default.

I decided that we should implement this, mainly because CURL does not follow redirects by default.
electricdusk removed the
question
label 2019-12-19 22:34:52 +01:00
Sign in to join this conversation.
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: electricdusk/rushlink#28
No description provided.