mirror of
https://codeup.aliyun.com/64f7d6b8ce01efaafef1e678/coal/coal.git
synced 2026-01-24 23:41:21 +08:00
处理前缀问题
This commit is contained in:
15
README.md
Normal file
15
README.md
Normal file
@@ -0,0 +1,15 @@
|
||||
|
||||
## 命令
|
||||
|
||||
重启服务:
|
||||
|
||||
```
|
||||
kubectl --kubeconfig=homelab.yaml --namespace=coal-master rollout restart deployment nginx
|
||||
```
|
||||
|
||||
|
||||
更新k8s配置文件
|
||||
|
||||
```
|
||||
kubectl apply --kubeconfig=homelab.yaml -k .\k8s\master\
|
||||
```
|
||||
@@ -40,6 +40,10 @@ patchesStrategicMerge:
|
||||
name: nginx-conf
|
||||
data:
|
||||
default.conf: |-
|
||||
map $http_x_gray $target_url {
|
||||
default "http://coal-api.coal-master.svc.cluster.local:7456/";
|
||||
~*lhj "http://192.168.0.113:7456/";
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
@@ -49,14 +53,16 @@ patchesStrategicMerge:
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
location /api/ {
|
||||
proxy_pass http://coal-api.coal-master.svc.cluster.local:7456/;
|
||||
location ~ ^/api/(?<suffix>.*)$ {
|
||||
proxy_pass $target_url$suffix;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header Host $proxy_host;
|
||||
proxy_set_header X-Forwarded-Host $http_host;
|
||||
proxy_set_header X-Forwarded-Proto http;
|
||||
proxy_set_header X-Forwarded-Port 80;
|
||||
proxy_set_header X-DEBUG $suffix;
|
||||
proxy_set_header X-DEBUG2 123;
|
||||
proxy_set_header X-Forwarded-Prefix /api/;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ server:
|
||||
port: 7456
|
||||
|
||||
|
||||
forward-headers-strategy: framework
|
||||
# forward-headers-strategy: framework
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user