From c0cd10f9ffcf887b47a1b9ce3d39f1f7036d3921 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 9 Apr 2023 16:22:38 +0800 Subject: [PATCH 1/3] cleanup --- conf/alchemy/proc.conf | 1 - conf/alchemy/ts.conf | 1 - 2 files changed, 2 deletions(-) diff --git a/conf/alchemy/proc.conf b/conf/alchemy/proc.conf index bcf493c..03d2092 100644 --- a/conf/alchemy/proc.conf +++ b/conf/alchemy/proc.conf @@ -8,7 +8,6 @@ server { ssl_certificate /etc/letsencrypt/live/alchemy-studio.cn/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/alchemy-studio.cn/privkey.pem; # managed by Certbot - location /api/v1/proc/ { add_header Access-Control-Allow-Origin $http_origin always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; diff --git a/conf/alchemy/ts.conf b/conf/alchemy/ts.conf index e3dab46..e506e97 100644 --- a/conf/alchemy/ts.conf +++ b/conf/alchemy/ts.conf @@ -8,7 +8,6 @@ server { ssl_certificate /etc/letsencrypt/live/alchemy-studio.cn/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/alchemy-studio.cn/privkey.pem; # managed by Certbot - location /api/v1/ts/ { add_header Access-Control-Allow-Origin $http_origin always; add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; From 086e1a0d7d5626bb73fd39d47f05f7f4187077dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 9 Apr 2023 16:27:14 +0800 Subject: [PATCH 2/3] add proc config to resty --- conf/moicen/proc.conf | 22 ++++++++++++++++++++++ cp_scripts_alchemy.sh | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 conf/moicen/proc.conf diff --git a/conf/moicen/proc.conf b/conf/moicen/proc.conf new file mode 100644 index 0000000..7272f14 --- /dev/null +++ b/conf/moicen/proc.conf @@ -0,0 +1,22 @@ +server { + server_name "proc.moicen.com"; + listen 443 ssl; + listen 80; + client_max_body_size 10M; + + # disable in local test env + ssl_certificate /etc/letsencrypt/live/moicen.com/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/moicen.com/privkey.pem; # managed by Certbot + + location /api/v1/proc/ { + add_header Access-Control-Allow-Origin $http_origin always; + add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS' always; + add_header Access-Control-Allow-Headers 'Authorization,HtyAdminToken,HtySudoerToken,HtyHost,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type' always; + add_header Access-Control-Allow-Credentials true always; + add_header Access-Control-Max-Age 86400 always; + if ($request_method = 'OPTIONS') { + return 200; + } + proxy_pass http://127.0.0.1:8880/api/v1/ts/; + } +} diff --git a/cp_scripts_alchemy.sh b/cp_scripts_alchemy.sh index 4fa9c2f..2073c02 100755 --- a/cp_scripts_alchemy.sh +++ b/cp_scripts_alchemy.sh @@ -24,7 +24,7 @@ mkdir -p $openresty_lua_scripts_dir cp -rv scripts/* $openresty_lua_scripts_dir # -- Replace scripts path in file sed -i -e "s||$openresty_lua_scripts_dir|g" \ - "$openresty_lua_scripts_dir"/*.lua \ + "$openresty_lua_scripts_dir"/*.lua \ "$openresty_lua_scripts_dir"/lib/*.lua \ # Reload openresty From 02e72062b761a7abd24700d85bbc6b974adb22ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=94=B7?= Date: Sun, 9 Apr 2023 22:51:48 +0800 Subject: [PATCH 3/3] fix proc moicen config --- conf/moicen/proc.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/moicen/proc.conf b/conf/moicen/proc.conf index 7272f14..c84b7b4 100644 --- a/conf/moicen/proc.conf +++ b/conf/moicen/proc.conf @@ -17,6 +17,6 @@ server { if ($request_method = 'OPTIONS') { return 200; } - proxy_pass http://127.0.0.1:8880/api/v1/ts/; + proxy_pass http://127.0.0.1:8880/api/v1/proc/; } }