fix: 修正 nginx upstream server 的参数被丢弃的问题#223
Draft
hellowillwan wants to merge 1 commit intojumpserver:devfrom
Draft
fix: 修正 nginx upstream server 的参数被丢弃的问题#223hellowillwan wants to merge 1 commit intojumpserver:devfrom
hellowillwan wants to merge 1 commit intojumpserver:devfrom
Conversation
当 web:8080 后面添了加其它参数时,会在替换时被丢掉。
v3.10.12 版演示如下:
```
root@jms_web:/opt# head /etc/nginx/sites-enabled/https_server.conf
# Todo: May be can auto discovery
upstream http_server {
ip_hash;
server web:8080 weight=10; # 这个是可以通过容器访问, 外部访问是 80端口
# server HOST2:80; # 另外的要写真实IP
server 10.189.143.92:8980 weight=6;
}
...
root@jms_web:/opt# diff /etc/nginx/sites-enabled/https_server.conf /etc/nginx/conf.d/https_server.conf
4c4
< server web:8080 weight=10; # 这个是可以通过容器访问, 外部访问是 80端口
---
> server localhost:51980; # 这个是可以通过容器访问, 外部访问是 80端口
```
测试
```
$ echo 'server web:8080 weight=10; # 这个是可以通过容器访问, 外部访问是 80端口' | sed "s@server web[:0-9]*@server localhost:51980@g"
server localhost:51980 weight=10; # 这个是可以通过容器访问, 外部访问是 80端口
$ echo 'server web:8080; # 这个是可以通过容器访问, 外部访问是 80端口' | sed "s@server web[:0-9]*@server localhost:51980@g"
server localhost:51980; # 这个是可以通过容器访问, 外部访问是 80端口
$ echo 'server web; # 这个是可以通过容器访问, 外部访问是 80端口' | sed "s@server web[:0-9]*@server localhost:51980@g"
server localhost:51980; # 这个是可以通过容器访问, 外部访问是 80端口
```
Member
|
呼声不是很高,先合并了 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
当 server web:8080 后面添了加其它参数时,会在替换时被丢弃。
v3.10.12 版演示如下:
'weight=10' 被丢弃了。
修正后,不同情况的测试结果如下: