[PATCH compass-ci] container/web-backend-nginx: add proxy for srv-http server

[why] we required access api by https request [how] use web-backend-nginx server to proxy srv-http server that user can access like: https://api.compass-ci.openeuler.org:11320/result/iozone/taishan200-2288-2s6... Signed-off-by: Lu Weitao <luweitaobe@163.com> --- container/web-backend-nginx/nginx.conf | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/container/web-backend-nginx/nginx.conf b/container/web-backend-nginx/nginx.conf index b461a2c..c9a4ec4 100644 --- a/container/web-backend-nginx/nginx.conf +++ b/container/web-backend-nginx/nginx.conf @@ -22,5 +22,14 @@ http { # web-backend server proxy_pass http://172.17.0.1:32767; } + + location ~ ^/(result|pub) { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; + + # srv-http server + proxy_pass http://172.17.0.1:11300; + } } } -- 2.23.0

On Sat, Nov 07, 2020 at 04:39:52PM +0800, Lu Weitao wrote:
[why] we required access api by https request [how] use web-backend-nginx server to proxy srv-http server that user can access like: https://api.compass-ci.openeuler.org:11320/result/iozone/taishan200-2288-2s6...
Signed-off-by: Lu Weitao <luweitaobe@163.com> --- container/web-backend-nginx/nginx.conf | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/container/web-backend-nginx/nginx.conf b/container/web-backend-nginx/nginx.conf index b461a2c..c9a4ec4 100644 --- a/container/web-backend-nginx/nginx.conf +++ b/container/web-backend-nginx/nginx.conf @@ -22,5 +22,14 @@ http { # web-backend server proxy_pass http://172.17.0.1:32767; } + + location ~ ^/(result|pub) { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; + + # srv-http server + proxy_pass http://172.17.0.1:11300; + } } }
这个会被反向代理到 https://api.xxx:11320/result https://api.xxx:11320/pub 不知道这样对吗? Thanks, Zhang Yuhang
2.23.0

+++ b/container/web-backend-nginx/nginx.conf @@ -22,5 +22,14 @@ http { # web-backend server proxy_pass http://172.17.0.1:32767; } + + location ~ ^/(result|pub) { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; + + # srv-http server + proxy_pass http://172.17.0.1:11300; + } } }
这个会被反向代理到 https://api.xxx:11320/result https://api.xxx:11320/pub 不知道这样对吗?
是的,srv-http server 开放了/srv/result, /srv/pub 这两个文件夹 Thanks, Weitao
Thanks, Zhang Yuhang
2.23.0

On Mon, Nov 09, 2020 at 10:28:10AM +0800, Lu Weitao wrote:
+++ b/container/web-backend-nginx/nginx.conf @@ -22,5 +22,14 @@ http { # web-backend server proxy_pass http://172.17.0.1:32767; } + + location ~ ^/(result|pub) { + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forward-For $proxy_add_x_forwarded_for; + + # srv-http server + proxy_pass http://172.17.0.1:11300; + } } }
这个会被反向代理到 https://api.xxx:11320/result https://api.xxx:11320/pub 不知道这样对吗?
是的,srv-http server 开放了/srv/result, /srv/pub 这两个文件夹
Thanks, Weitao
端口换成11320吗? Thanks, Zhang Yuhang
participants (2)
-
Lu Weitao
-
Zhang Yuhang