首页 > 解决方案 > Gitlab CE 抛出错误,Web IDE 挂在 nginx 反向 pxy (jwilder) 后面

问题描述

我是新来的。

我在反向代理(Docker/nginx-letsencrypt by jwilder)后面的 gitlab CE(Docker)有一个奇怪的错误,当图像端口 80 和 443 直接映射到主机端口时,相同的 Docker 映像运行没有任何错误。对 web-ide 的 http 调用是有效的。代理后面的相同图像,其中为 gitlab 设置了 VIRTUAL_PORT=80,并且通过代理公开了 443 + 80)。一切都按预期工作,只是 web-ide 没有加载。

不明白为什么没有代理 ssl 的 gitlab web ide 可以与不安全的 http 一起使用?仅使用 http 运行 gitlab 不是一种选择;-)

Chrome的错误输出:

vue-resource.esm.js:1086 Mixed Content: The page at 'https://lab.flockcode.com/-/ide/project/flockcode/flockcode_homepage/edit/master/.gitlab-ci.yml' was loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://lab.flockcode.com/flockcode/flockcode_homepage/files/master?format=json'. This request has been blocked; the content must be served over HTTPS.
(anonymous) @ vue-resource.esm.js:1086
r @ vue-resource.esm.js:196
X @ vue-resource.esm.js:1032
Q @ vue-resource.esm.js:1190
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
V @ vue-resource.esm.js:990
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
K @ vue-resource.esm.js:1004
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
z @ vue-resource.esm.js:977
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
U @ vue-resource.esm.js:880
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
H @ vue-resource.esm.js:865
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
G @ vue-resource.esm.js:1024
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
q @ vue-resource.esm.js:846
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
(anonymous) @ vue_resource_interceptor.js:13
c @ vue-resource.esm.js:1147
l @ vue-resource.esm.js:1173
(anonymous) @ vue_resource_interceptor.js:24
c @ vue-resource.esm.js:1147
(anonymous) @ vue-resource.esm.js:1176
r @ vue-resource.esm.js:196
t @ vue-resource.esm.js:1140
oe @ vue-resource.esm.js:1397
oe.(anonymous function) @ vue-resource.esm.js:1428
getFiles @ index.js:72
(anonymous) @ tree.js:59
Rn @ tree.js:53
(anonymous) @ vuex.esm.js:704
P.dispatch @ vuex.esm.js:426
P.dispatch @ vuex.esm.js:332
(anonymous) @ ide_router.js:72
Promise.then (async)
(anonymous) @ ide_router.js:62
p @ vue-router.esm.js:1943
r @ vue-router.esm.js:1717
ue @ vue-router.esm.js:1725
nn.confirmTransition @ vue-router.esm.js:1972
nn.transitionTo @ vue-router.esm.js:1874
sn.init @ vue-router.esm.js:2494
beforeCreate @ vue-router.esm.js:540
Re @ vue.esm.js:2895
e._init @ vue.esm.js:4556
At @ vue.esm.js:4659
(anonymous) @ index.js:10
./ide/index.js @ index.js:22
r @ bootstrap cc923a667f9c8788713a:54
window.webpackJsonp @ bootstrap cc923a667f9c8788713a:25
(anonymous) @ ide.436113d38b71e60d098b.bundle.js:1
.gitlab-ci.yml:1 Uncaught (in promise) je {url: "http://lab.flockcode.com/flockcode/flockcode_homepage/files/master?format=json", ok: false, status: 0, statusText: "", headers: {…}, …}

因为我不知道从哪里开始,我尝试了各种 /etc/gitlab/gitlab.rb 设置(包括取消注释 X 标头部分无效)a 并且容器需要很长时间才能重新启动我恳请帮助. 提前谢谢。

标签: dockerjwilder-nginx-proxygitlab-ceweb-ide

解决方案


也许和我一样的问题。

  • 反向代理(nginx)
    • 带 Letsencrypt 证书
  • Gitlab-ce docker 容器

起初,我用'HTTP'设置了external_url,然后除了Web IDE之外一切都好

https://docs.gitlab.com/omnibus/settings/nginx.html#supporting-proxied-ssl

默认情况下,如果 external_url 包含 https://,NGINX 将自动检测是否使用 SSL。如果您在反向代理后面运行 GitLab,您可能希望在另一个代理服务器或负载均衡器上终止 SSL。为此,请确保 external_url 包含https://并将以下配置应用于 gitlab.rb:

所以,我在 external_url 中更改了 http -> https,并将“listen_https”更改为 false

external_url ' https://gitlab.example.com '
nginx['listen_https'] = false

那么对我来说一切都好。

可能对你有所帮助

http://blog.hangadac.com


推荐阅读