PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, June 25, 2022

[FIXED] How to disable http to https re-direct in Jenkins?

 June 25, 2022     apache, jenkins, reverse-proxy     No comments   

Issue

I currently have Jenkins running behind SSL with http re-driecting to https. For a custom integration which doesn't support SSL yet, I need to disable the http to https re-direct. I am unable to do so by commenting the re-direct in apache conf.

Following is my apache config.

 <VirtualHost *:80>
  ServerName jenkins-tb.myorg.com
  ServerAlias www.jenkins-tb.myorg.com
  ProxyRequests Off
  ProxyVia On
  Redirect permanent / https://jenkins-tb.myorg.com/
#  RewriteEngine On
#  RewriteCond %{HTTPS} !=on
#  RewriteRule ^/?login/(.*) https://%{SERVER_NAME}/login/$1 [R,L]
</Virtualhost>


<VirtualHost *:443>
  ServerName jenkins-tb.myorg.com
  ServerAlias www.jenkins-tb.myorg.com

  SSLEngine On
  SSLProxyEngine On
  SSLCertificateFile    /etc/apache2/ssl/crt/jenkins-asd.myorg.com.crt
  SSLCertificateKeyFile /etc/apache2/ssl/key/server_jenkins-asd.myorg.com.key

  ProxyRequests     Off
  ProxyPass         /  http://localhost:8080/
  ProxyPassReverse  /  http://localhost:8080/
 # ProxyPassReverse /login http://jenkins-thunderbolt.myorg.com/login
 # ProxyPassReverse /login https://jenkins-thunderbolt.myorg.com/login

  ProxyPass        /sonar http://localhost:9000/sonar
  ProxyPassReverse /sonar http://localhost:9000/sonar

  RequestHeader set X_FORWARDED_PROTO "https"
  RequestHeader set X-Forwarded-Port "443"
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1

  <Proxy http://localhost:8080/*>
   Order allow,deny
    Allow from all
  </Proxy>
  ProxyPreserveHost on
#  AllowEncodedSlashes NoDecode
</VirtualHost>

How do i re-enable http without disabling https? Basically need to stop re-direction from http to https.


Solution

Based on you configuration, replace the <VirtualHost *:80> block with the following. But please note, passwords are now transfered in clear text.

<VirtualHost *:80>
  ServerName jenkins-tb.myorg.com
  ServerAlias www.jenkins-tb.myorg.com

  ProxyRequests     Off
  ProxyPass         /  http://localhost:8080/
  ProxyPassReverse  /  http://localhost:8080/

  ProxyPass        /sonar http://localhost:9000/sonar
  ProxyPassReverse /sonar http://localhost:9000/sonar

  RequestHeader set X_FORWARDED_PROTO "http"
  RequestHeader set X-Forwarded-Port "80"
  SetEnv force-proxy-request-1.0 1
  SetEnv proxy-nokeepalive 1

  <Proxy http://localhost:8080/*>
   Order allow,deny
    Allow from all
  </Proxy>
  ProxyPreserveHost on
</Virtualhost>

This also includes that /sonar is also available over http.



Answered By - JGK
Answer Checked By - Robin (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing