Update site.py

pull/652/head
Mr Chen 5 months ago
parent 0348cc55c6
commit 28c2b6dc77
  1. 12
      web/utils/site.py

@ -1526,6 +1526,7 @@ location ^~ {from} {\n\
proxy_http_version 1.1;\n \
\n \
add_header X-Cache $upstream_cache_status;\n \
{cors}\n \
\n \
{proxy_cache}\n \
}\n\
@ -1554,6 +1555,12 @@ location ^~ {from} {\n\
add_header Cache-Control no-cache;\n \
}\n \
"
tpl_proxy_cors = "\n \
add_header 'Access-Control-Allow-Methods' 'GET,OPTIONS,POST' always;\n \
add_header 'Access-Control-Allow-Credentials' 'true';\n \
add_header 'Access-Control-Allow-Origin' *;\n \
add_header 'Access-Control-Allow-Headers' *;\n \
"
# replace
if site_from[0] != '/':
@ -1569,6 +1576,11 @@ location ^~ {from} {\n\
else:
tpl = tpl.replace("{proxy_cache}", tpl_proxy_nocache, 999)
if open_cors == 'on':
tpl = tpl.replace("{cors}", tpl_proxy_cors, 999)
else:
tpl = tpl.replace("{cors}", tpl_proxy_cors, 999)
conf_proxy = "{}/{}.conf".format(self.getProxyPath(site_name), proxy_id)
conf_bk = "{}/{}.conf.txt".format(self.getProxyPath(site_name), proxy_id)

Loading…
Cancel
Save