mirror of
https://gitea.invidious.io/iv-org/invidious-copy-2022-08-14.git
synced 2024-08-15 00:53:20 +00:00
Only add HTTP query if it exists
This commit is contained in:
parent
cf07b66c12
commit
6d7ae6f638
1 changed files with 4 additions and 1 deletions
|
@ -343,7 +343,10 @@ if Kemal.config.ssl && redirect
|
||||||
spawn do
|
spawn do
|
||||||
server = HTTP::Server.new("0.0.0.0", 80) do |context|
|
server = HTTP::Server.new("0.0.0.0", 80) do |context|
|
||||||
context.response.headers.add "Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload"
|
context.response.headers.add "Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload"
|
||||||
redirect_url = "https://#{context.request.host}#{context.request.path}?#{context.request.query}"
|
redirect_url = "https://#{context.request.host}#{context.request.path}"
|
||||||
|
if context.request.query
|
||||||
|
redirect_url += "?#{context.request.query}"
|
||||||
|
end
|
||||||
context.response.headers.add "Location", redirect_url
|
context.response.headers.add "Location", redirect_url
|
||||||
context.response.status_code = 301
|
context.response.status_code = 301
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue