Skip to content

Commit d6098e5

Browse files
authored
fix/OPS-318 : proxy host 스위칭ì� ssl 인증서 유지 (#60)
1 parent 2edf688 commit d6098e5

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.github/workflows/prod-server.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ jobs:
6060
echo "📋 Checking current NPM configuration... 📋"
6161
CURRENT_CONFIG=$(curl -s -H "Authorization: Bearer $TOKEN" \
6262
"http://${NPM_HOST}/api/nginx/proxy-hosts/${PROXY_HOST_ID}")
63+
echo "Current Config: $CURRENT_CONFIG"
6364
6465
CURRENT_TARGET=$(echo $CURRENT_CONFIG | jq -r '.[0].forward_host // .forward_host')
6566
CURRENT_PORT=$(echo $CURRENT_CONFIG | jq -r '.[0].forward_port // .forward_port')
@@ -109,6 +110,7 @@ jobs:
109110
# NPM에서 트래픽 스위칭
110111
echo "🔄 Switching traffic in Nginx Proxy Manager..."
111112
DOMAIN_NAME=$(echo $CURRENT_CONFIG | jq -r '.domain_names[0]')
113+
CERT_ID=$(echo "$CURRENT_CONFIG" | jq -r '.certificate_id')
112114
113115
SWITCH_RESPONSE=$(curl -s -w "%{http_code}" -X PUT "http://${NPM_HOST}/api/nginx/proxy-hosts/${PROXY_HOST_ID}" \
114116
-H "Authorization: Bearer $TOKEN" \
@@ -122,10 +124,10 @@ jobs:
122124
\"block_exploits\": true,
123125
\"advanced_config\": \"\",
124126
\"locations\": [],
125-
\"certificate_id\": 0,
126-
\"ssl_forced\": 0,
127-
\"hsts_enabled\": 0,
128-
\"hsts_subdomains\": 0
127+
\"certificate_id\": $CERT_ID,
128+
\"ssl_forced\": 1,
129+
\"hsts_enabled\": 1,
130+
\"hsts_subdomains\": 1
129131
}")
130132
131133
HTTP_CODE=${SWITCH_RESPONSE: -3}

.github/workflows/test-server.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ jobs:
201201
# NPM에서 트래픽 스위칭
202202
echo "🔄 Switching traffic in Nginx Proxy Manager..."
203203
DOMAIN_NAME=$(echo $CURRENT_CONFIG | jq -r '.domain_names[0]')
204+
CERT_ID=$(echo "$CURRENT_CONFIG" | jq -r '.certificate_id')
204205

205206
SWITCH_RESPONSE=$(curl -s -w "%{http_code}" -X PUT "http://${NPM_HOST}/api/nginx/proxy-hosts/${PROXY_HOST_ID}" \
206207
-H "Authorization: Bearer $TOKEN" \
@@ -214,10 +215,10 @@ jobs:
214215
\"block_exploits\": true,
215216
\"advanced_config\": \"\",
216217
\"locations\": [],
217-
\"certificate_id\": 0,
218-
\"ssl_forced\": 0,
219-
\"hsts_enabled\": 0,
220-
\"hsts_subdomains\": 0
218+
\"certificate_id\": $CERT_ID,
219+
\"ssl_forced\": 1,
220+
\"hsts_enabled\": 1,
221+
\"hsts_subdomains\": 1
221222
}")
222223

223224
HTTP_CODE=${SWITCH_RESPONSE: -3}

0 commit comments

Comments
 (0)