Jenkins URL https://<mydns>.com/ is not working(502 Bad Gateway)

24 views
Skip to first unread message

anilkumar panditi

unread,
Feb 10, 2021, 3:14:04 AM2/10/21
to Jenkins Users
Hi,
I have configured jenkins URL ,
Manage Jenkins>System configuration>Jenkins Location>Jenkins URL

ex: https://<mydns>.com/

And i have curled on host where Jenkins running as docker container ,

[root@ip- ~]# curl -kv https://<dns>.com/
* About to connect() to DNS.com port 443 (#0)
*   Trying xxxxx...
* Connected to DNS.com (IP) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* skipping SSL peer certificate verification
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=DNS.com

 HTTP/1.1 502 Bad Gateway
< Server: awselb/2.0
< Date: Wed, 10 Feb 2021 08:11:05 GMT
< Content-Type: text/html
< Content-Length: 122
< Connection: keep-alive


Any idea why its not working , please help?

Dirk Heinrichs

unread,
Feb 10, 2021, 5:39:55 AM2/10/21
to jenkins...@googlegroups.com
Am Mittwoch, den 10.02.2021, 00:14 -0800 schrieb anilkumar panditi:

And i have curled on host where Jenkins running as docker container ,

So, this seems to be a Docker question rather than a Jenkins one, doesn't it? Anyway, did you start your container with an appropriate port mapping for port 443 (option -p)? And maybe check that containers on that host are generally reachable from other hosts (or, i.o.w.: that your Docker networking is setup properly).

HTH...

Dirk
-- 
Dirk Heinrichs
Senior Systems Engineer, Delivery Pipeline
OpenText ™ Discovery | Recommind
Recommind GmbH, Von-Liebig-Straße 1, 53359 Rheinbach
Vertretungsberechtigte Geschäftsführer Gordon Davies, Madhu Ranganathan, Christian Waida, Registergericht Amtsgericht Bonn, Registernummer HRB 10646
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail sind nicht gestattet.
signature.asc

anilkumar panditi

unread,
Feb 10, 2021, 7:00:51 AM2/10/21
to Jenkins Users
Hi Dirk, 
Thank you , 
Jenkins container started like below.

docker run --name myjenkins -d -u root -p 8080:8080 -p 50000:50000 -v $(which docker):/usr/bin/docker -v /jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock  myjenkins

And i curled from other host and it gets connected and throwing 502 bad gateway.

Thanks,
Anil

Dirk Heinrichs

unread,
Feb 10, 2021, 7:09:44 AM2/10/21
to jenkins...@googlegroups.com
Am Mittwoch, den 10.02.2021, 04:00 -0800 schrieb anilkumar panditi:

docker run --name myjenkins -d -u root -p 8080:8080 -p 50000:50000 -v $(which docker):/usr/bin/docker -v /jenkins:/var/jenkins_home -v /var/run/docker.sock:/var/run/docker.sock  myjenkins

And i curled from other host and it gets connected and throwing 502 bad gateway.

From your first mail, you where running curl with "https://...", which means port 443. I see no mapping of port 443 in the above command. Try running curl with "http://...:8080".
signature.asc

anilkumar panditi

unread,
Feb 11, 2021, 6:36:16 AM2/11/21
to Jenkins Users
Hi Dirk,
Could you please give the docker run command to use 443 ,

Thanks
Anil Panditi

Dirk Heinrichs

unread,
Feb 11, 2021, 6:56:08 AM2/11/21
to jenkins...@googlegroups.com
Am Donnerstag, den 11.02.2021, 03:36 -0800 schrieb anilkumar panditi:

Could you please give the docker run command to use 443 ,

I could (and did, see my previous responses), but I doubt it would make sense, since I don't think the Jenkins inside your container is configured to use SSL, or is it?

If you want to protect your Jenkins setup with SSL, I'd recommend running an Apache2 or NGinx webserver as a reverse proxy in front of it to handle the SSL stuff (see Jenkins documentation). This could be running directly on your Docker host, inside a container or even on a remote machine, but that's up to you.

As long as you don't have this set up, it doesn't make sense to try to connect using https://. Please first try to connect w/o SSL to confirm it's working, by using "curl http://<hostname>:8080" from a remote host. Then setup SSL.

BTW: If you change your "-p 8080:8080" to "-p 80:8080", to map the hosts port 80 to the containers port 8080, you can omit the port number when running your curl command, since 80 is the standard port for http:// (the command becomes just "curl http://<hostname>".
signature.asc
Reply all
Reply to author
Forward
0 new messages