首页 > 解决方案 > docker中的plantuml,gitlab nginx配置不起作用

问题描述

Plantuml 在 docker 上运行。
端口必须从 8080:8080 更改为 8088:8080。
它适用于http://localhost:8088/uml,不适用于http://localhost:8088/plantuml

gitlab推荐如下配置

nginx['custom_gitlab_server_config'] = "location /-/plantuml { \n rewrite ^/-/(plantuml.*) /$1 break;\n proxy_cache off; \n proxy_pass http://localhost:8088/plantuml; \n}\n"

由于上述情况,我尝试了以下方法但没有成功(uml 而不是 plantuml)

nginx['custom_gitlab_server_config'] = "location /-/plantuml { \n rewrite ^/-/(plantuml.*) /$1 break;\n proxy_cache off; \n proxy_pass http://localhost:8088/uml; \n}\n"

你有什么建议如何解决这个问题吗?

编辑添加:按照建议我尝试过

nginx['custom_gitlab_server_config'] = "location /-/plantuml { \n rewrite ^/-/plantuml(.*) /uml$1 break;\n proxy_cache off; \n proxy_pass http://localhost:8088/uml; \n}\n"

调用结果为https://gitlabdomain.com/uml/AxfDWj2tBq3CoKoPWR1Io8ZDoSa70000404

http vs https 可以在这里相关吗?

标签: nginxgitlabplantuml

解决方案


我有完全相同的问题,这似乎有效:

nginx['custom_gitlab_server_config'] = "location /-/plantuml { \n rewrite ^/-/plantuml(.*) $1 break;\n proxy_cache off; \n proxy_pass http://localhost:YOUR_PORT/uml; \n}\n"

换句话说,我plantuml从 URI 中删除,并将 URI 的其余部分简单地传递给后端。


推荐阅读