简体   繁体   English

如何处理 jenkins http -> https 重定向?

[英]How to handle jenkins http -> https redirect?

I currently have jenkins set up with AWS fargate with ECS.我目前使用 AWS fargate 和 ECS 设置了 jenkins。 There is a classic load balancer in front.前面有一个经典的负载均衡器。

Things i have tried:我尝试过的事情:

  • Putting nginx onto the core jenkins image and issuing a re-direct but I do not use nginx for anything else so I am against this solution.将 nginx 放到核心 jenkins 映像上并发出重定向,但我不使用 nginx 做其他任何事情,所以我反对这个解决方案。

  • I have switched to an application load balancer but this does not work as I use the fargate plugin for my jenkins job with their own agents.我已切换到应用程序负载均衡器,但这不起作用,因为我使用 fargate 插件和他们自己的代理来完成我的 jenkins 作业。 The agents traffic is on tcp 5050. Perhaps I am doing something wrong here?代理流量在 tcp 5050 上。也许我在这里做错了什么?

I have looked into using Jetty to issue the redirect.我已经研究过使用 Jetty 来发出重定向。 I noticed winstone supports this and it has been included in Jenkins 2.243我注意到 winstone 支持这一点,它已包含在 Jenkins 2.243 中

  • Winstone 5.10: Add --httpsRedirectHttp option that activates automatic HTTP request redirects to HTTPs. Winstone 5.10:添加 --httpsRedirectHttp 选项,激活自动 HTTP 请求重定向到 HTTPs。 (pull 4811) (拉4811)

I have already defined some options in my core jenkins container我已经在我的核心 jenkins 容器中定义了一些选项

ENV JAVA_OPTS="-Djenkins.install.runSetupWizard=false -Djava.awt.headless=true -Xmx2048m ${JAVA_OPTS:-}"

How would I extend this to include the http -> https functionallity included in jenkins 2.243?我将如何扩展它以包括 jenkins 2.243 中包含的 http -> https 功能?

I am also facing the same issue, I tried with multiple versions, but didn't see it working.我也面临同样的问题,我尝试了多个版本,但没有看到它工作。

I am using an external load balancer with Jenkins deployed in Kubernetes in GCP.我正在使用外部负载均衡器,其中 Jenkins 部署在 GCP 的 Kubernetes 中。 some times the Jenkins redirects from HTTPS to HTTP, where we have blocked the HTTP request on the load balancer, and Jenkins is not able to load the pages. some times the Jenkins redirects from HTTPS to HTTP, where we have blocked the HTTP request on the load balancer, and Jenkins is not able to load the pages.

this should be fixed by jenkins.这应该由 jenkins 修复。

According to https://github.com/jenkinsci/winstone/pull/98 , I added --httpsRedirectHttp.根据https://github.com/jenkinsci/winstone/pull/98 ,我添加了--httpsRedirectHttp。 It works!有用!

-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "D:\Program Files\Jenkins\jenkins.war" --httpPort=80 --httpsPort=443 --httpsRedirectHttp --httpsKeyStore="%LocalAppData%\Jenkins\my.jks" --httpsKeyStorePassword= --webroot="%LocalAppData%\Jenkins\war" -Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -jar "D:\Program Files\Jenkins\jenkins.war" --httpPort=80 --httpsPort=443 --httpsRedirectHttp --httpsKeyStore="%LocalAppData% \Jenkins\my.jks" --httpsKeyStorePassword= --webroot="%LocalAppData%\Jenkins\war"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM