mirror of
https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git
synced 2025-09-02 20:52:41 +02:00
Prevent HTTPS redirects for 127.0.0.1 (#1846)
This is helpful for when a host is connected over an ssh tunnel, and sends "localhost" for the HOST header. If it is an ssh tunnel, it is already secured. And browsers have trouble with redirects to https://localhost
This commit is contained in:
@@ -52,10 +52,13 @@ $HTTP["url"] !~ "^/.well-known/(.*)" {
|
||||
#SSL is enabled by default
|
||||
#If disabling SSL you must clear your site cookie
|
||||
$HTTP["scheme"] == "http" {
|
||||
# capture vhost name with regex conditiona -> %0 in redirect pattern
|
||||
# must be the most inner block to the redirect rule
|
||||
$HTTP["host"] =~ ".*" {
|
||||
url.redirect = (".*" => "https://%0$0")
|
||||
# Do not apply rule to 127.0.0.1, for ssh tunnels
|
||||
$HTTP["remote-ip"] != "127.0.0.1" {
|
||||
# capture vhost name with regex conditiona -> %0 in redirect pattern
|
||||
# must be the most inner block to the redirect rule
|
||||
$HTTP["host"] =~ ".*" {
|
||||
url.redirect = (".*" => "https://%0$0")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user