From bbc775d9e7737f917907d64e156e0364c8f839c7 Mon Sep 17 00:00:00 2001 From: ChenSaizhong Date: Thu, 22 Apr 2021 09:59:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=8D=E5=AF=86=E7=99=BB=E5=BD=95nginx?= =?UTF-8?q?=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/myconf.conf.template | 6 ++++++ template/ssl_myconf.conf.template | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/template/myconf.conf.template b/template/myconf.conf.template index eab0c03..fb027e3 100644 --- a/template/myconf.conf.template +++ b/template/myconf.conf.template @@ -30,6 +30,12 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://one-app:8080; } + location ~ /autologin { + proxy_set_header host $host:$server_port; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://one-app:8080; + } location /wp-login.php { proxy_set_header host $host:$server_port; diff --git a/template/ssl_myconf.conf.template b/template/ssl_myconf.conf.template index 352979c..25cdc9a 100644 --- a/template/ssl_myconf.conf.template +++ b/template/ssl_myconf.conf.template @@ -89,6 +89,23 @@ server { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://one-app:8080; } + # 免密登录 + location ~ /autologin { + add_header 'Access-Control-Allow-Credentials' 'true'; + add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept'; + add_header 'Access-Control-Allow-Methods' 'POST, GET, PUT, OPTIONS, DELETE'; + add_header 'Access-Control-Allow-Origin' *; + add_header 'Access-Control-Expose-Headers' 'Location'; + add_header Content-Type 'application/json; charset=utf-8'; + add_header Content-Security-Policy "upgrade-insecure-requests;connect-src *"; + add_header X-Frame-Options SAMEORIGIN; + proxy_cookie_path / "/; httponly"; + proxy_read_timeout 600; + proxy_set_header host $host:$server_port; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_pass http://one-app:8080; + } #登录 location /wp-login.php { add_header 'Access-Control-Allow-Credentials' 'true';