Jenkins URL not take effect

Hi,

We have a deployment in AWS EKS with ALB, traffic routing: Client → ALB → Istio → Jenkins
Image: jenkins/jenkins:2.332.1-jdk11

Originally, it works fine with this URL: (https ://jenkins.monitoring.xxx.xxx.xxx)
Recently, Jenkins returned URL becomes (http ://jenkins.monitoring.xxx.xxx.xxx:443) (http with a port of 443), so I got this error

400 Bad Request
The plain HTTP request was sent to HTTPS port

Here is the trouble shoot I did:

  1. In the Jenkins > Manage Jenkins > Configure System, Jenkins URL was configured with (https ://jenkins.monitoring.xxx.xxx.xxx), but Jenkins still return http+443, this is the config from Jenkins_home directory:
jenkins@jenkins-0:~$ more jenkins.model.JenkinsLocationConfiguration.xml
<?xml version='1.1' encoding='UTF-8'?>
<jenkins.model.JenkinsLocationConfiguration>
  <adminAddress>address not configured yet &lt;nobody@nowhere&gt;</adminAddress>
  <jenkinsUrl>https ://jenkins.monitoring.xxx.xxx.xxx/</jenkinsUrl>
</jenkins.model.JenkinsLocationConfiguration>
  1. When I removed Jenkins URL from UI (save with empty value), this one shows: http ://jenkins.monitoring.xxx.xxx.xxx:443/, and this is the config from Jenkins_home directory:
jenkins@jenkins-0:~$ more jenkins.model.JenkinsLocationConfiguration.xml
<?xml version='1.1' encoding='UTF-8'?>
<jenkins.model.JenkinsLocationConfiguration>
  <adminAddress>address not configured yet &lt;nobody@nowhere&gt;</adminAddress>
</jenkins.model.JenkinsLocationConfiguration>

Seems Jenkins URL config is properly configured, but it’s not taking effect.

When does it return that url? Sounds like something is trying to build the url not fetch it. It also sounds like your load balancer is doing https termination, but not providing X-Forwarded-Proto header. I’d guess because you have hops and it gets lost. If alb is terminating ssl, then make sure istio is passing along X-Forwarded-Proto (Pretty much all the X-Frowarded ones. X-Forwarded-For, X-Forwared-Host, X-Forwarded-Proto)

Yes, ALB is doing SSL termination.

I fixed it with adding X-Forwared-port and X-Forwared-Proto in Istio.

Thanks for your help @halkeye