- 修复苹果 Safari 下乱码问题
pull/413/head
Kane 2022-07-04 16:11:53 +08:00 committed by GitHub
parent 46207e6634
commit 9cd7e564ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 4 deletions

View File

@ -85,21 +85,24 @@ http {
server{ server{
listen 80; listen 80;
listen [::]:80 ipv6only=on; listen [::]:80 ipv6only=on;
charset utf-8;
location / { location / {
auth_basic ""; auth_basic "";
auth_basic_user_file /etc/openresty/auth; auth_basic_user_file /etc/openresty/auth;
add_header Content-Type text/plain; add_header Content-Type text/plain;
} }
location = /auth { location = /auth {
auth_basic ""; auth_basic "";
auth_basic_user_file /etc/openresty/auth; auth_basic_user_file /etc/openresty/auth;
add_header Content-Type text/plain; add_header Content-Type "text/plain; charset=utf-8";
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
content_by_lua_block { content_by_lua_block {
clientIP=ngx.var.remote_addr clientIP=ngx.var.remote_addr
headers=ngx.req.get_headers() headers=ngx.req.get_headers()
ngx.header.content_type = "text/plain;charset=UTF-8"
file = io.open("/etc/openresty/allow.list","a+") file = io.open("/etc/openresty/allow.list","a+")
io.input(file) io.input(file)
io.output(file) io.output(file)
@ -120,12 +123,12 @@ http {
os.execute("/usr/local/openresty/nginx/sbin/nginx -s reload") os.execute("/usr/local/openresty/nginx/sbin/nginx -s reload")
} }
} }
location = /purge { location = /purge {
auth_basic ""; auth_basic "";
auth_basic_user_file /etc/openresty/auth; auth_basic_user_file /etc/openresty/auth;
add_header Content-Type text/plain; add_header Content-Type "text/plain; charset=utf-8";
content_by_lua_block { content_by_lua_block {
ngx.header.content_type = "text/plain;charset=UTF-8";
file = io.open("/etc/openresty/allow.list","w+") file = io.open("/etc/openresty/allow.list","w+")
ngx.print("IP列表已被清空") ngx.print("IP列表已被清空")
io.close(file) io.close(file)