mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Use 302 to redirect instead of 301
`301` means "Moved Permanently", so browser caches this redirect, it is used when changing server URL. `302` means "Found", it is used generally (e.g. redirect top page after login). Each of `301`, `302`, `303` and `307` means redict, but they are different. We could choice those status in case.
This commit is contained in:
parent
9aa0819f29
commit
55361b3c9a
2 changed files with 3 additions and 3 deletions
|
@ -8,9 +8,9 @@ class HTTP::Server
|
|||
Kemal::ParamParser.new(@route, @request).parse
|
||||
end
|
||||
|
||||
def redirect(url)
|
||||
def redirect(url, status_code = 302)
|
||||
@response.headers.add "Location", url
|
||||
@response.status_code = 301
|
||||
@response.status_code = status_code
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue