{
http_port 80 https_port 443

跨域请求头

header / { -Server Access-Control-Allow-Origin * Access-Control-Allow-Methods 'GET, POST, OPTIONS' Access-Control-Allow-Headers 'authorization,Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' if {>Origin} is "null" { # 非简单请求需要添加以下头部 Access-Control-Allow-Credentials true Access-Control-Expose-Headers 'authorization,Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' } if {>Origin} is_not "null" { # 非简单请求需要添加以下头部 add_header 'Access-Control-Allow-Credentials' 'true' } if ($request_method == "OPTIONS") { return 204 } }

tp伪静态

rewrite / { if {path} not_match ^/.+.(gif|jpg|jpeg|png|bmp|swf)$ to /index.php?s={uri} }

静态文件缓存

@static { path_regexp .(gif|jpg|jpeg|png|bmp|swf)$ } header @static { Cache-Control 'public, max-age=2592000' Access-Control-Allow-Origin * Access-Control-Allow-Methods 'GET, POST, PUT,DELETE, OPTIONS' Access-Control-Allow-Headers 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,lang,access-token' if ($request_method == "OPTIONS") { return 204 } }

wss代理

reverse_proxy /wss/* 127.0.0.1:8282 { header_upstream Upgrade {>Upgrade} header_upstream Connection {>Connection} header_upstream X-Real-IP {remote} } }


原文地址: https://www.cveoy.top/t/topic/nS2t 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录