Closed amplitudesxd closed 2 months ago
@amplitudesxd Good catch. Updated with https://github.com/yourselfhosted/slash/commit/a3943f5b2d57e4acec1763877f2bdd58d26405eb
@johnnyjoygh — looks great, though I’m not sure if 303 would be the correct status code?
From MDN "The HyperText Transfer Protocol (HTTP) 303 See Other redirect status response code indicates that the redirects don't link to the requested resource itself, but to another page (such as a confirmation page, a representation of a real-world object — see HTTP range-14 — or an upload-progress page)."
I believe any one of 301, 307 or 308 would be correct, though if the user could configure which one, as is the case on many other shorteners, that would be even better (perhaps something for the roadmap?)
@amplitudesxd SGTM, thanks for the tips. https://github.com/yourselfhosted/slash/commit/5d703f563abf836a105c44b3461db7783430503b
Is your feature request related to a problem?
Using JavaScript, or even HTML for redirects isn't always ideal, it usually causes the page to load in the browser for a second before redirecting. When using the Location header, browsers generally redirect before trying to render the page - leading to a faster redirect, as well as a better user experience.
Describe the solution you'd like
Set the
Location
header when performing redirects, as well as a redirect status code (301/307). https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/LocationAdditional context
No response