|
|
@ -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})+.?" |
|
|
|
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): |
|
|
|
if not re.match(rep, _to): |
|
|
|
return mw.returnJson(False, "错误的目标地址!") |
|
|
|
return mw.returnJson(False, "错误的目标地址!") |
|
|
|
_to = _to.strip("/") |
|
|
|
|
|
|
|
|
|
|
|
# _to = _to.strip("/") |
|
|
|
# get host from url |
|
|
|
# get host from url |
|
|
|
try: |
|
|
|
try: |
|
|
|
if _host == "$host": |
|
|
|
if _host == "$host": |
|
|
@ -1546,9 +1547,10 @@ class site_api: |
|
|
|
except: |
|
|
|
except: |
|
|
|
return mw.returnJson(False, "错误的目标地址") |
|
|
|
return mw.returnJson(False, "错误的目标地址") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# location ~* ^{from}(.*)$ { |
|
|
|
tpl = """ |
|
|
|
tpl = """ |
|
|
|
# PROXY-START/ |
|
|
|
# PROXY-START/ |
|
|
|
location ~* ^{from}(.*)$ { |
|
|
|
location ^~ {from} { |
|
|
|
proxy_pass {to}; |
|
|
|
proxy_pass {to}; |
|
|
|
proxy_set_header Host {host}; |
|
|
|
proxy_set_header Host {host}; |
|
|
|
proxy_set_header X-Real-IP $remote_addr; |
|
|
|
proxy_set_header X-Real-IP $remote_addr; |
|
|
|