Update site_api.py

This commit is contained in:
midoks
2022-07-24 15:19:47 +08:00
parent 6b7dd1c6e1
commit 1f1ac45719
+4 -2
View File
@@ -1537,7 +1537,8 @@ class site_api:
rep = "http(s)?\:\/\/([a-zA-Z0-9][-a-zA-Z0-9]{0,62}\.)+([a-zA-Z0-9][a-zA-Z0-9]{0,62})+.?"
if not re.match(rep, _to):
return mw.returnJson(False, "错误的目标地址!")
_to = _to.strip("/")
# _to = _to.strip("/")
# get host from url
try:
if _host == "$host":
@@ -1546,9 +1547,10 @@ class site_api:
except:
return mw.returnJson(False, "错误的目标地址")
# location ~* ^{from}(.*)$ {
tpl = """
# PROXY-START/
location ~* ^{from}(.*)$ {
location ^~ {from} {
proxy_pass {to};
proxy_set_header Host {host};
proxy_set_header X-Real-IP $remote_addr;