0

Unable to configure Apache proxy configuration for bitbucket in Linux redhat 8 My SSL.conf file read like this... but not sure what is happening in terms of redirection and unable to achieve redirection. If you could guide me on this please. awaiting your reply. File reads as below :

  <VirtualHost *:80>
    ServerName http://stcvxbb01test.mydomain.com
     Redirect permanent / https://stcvxbb01test.mydomain.com:443
   </VirtualHost>
    #
    # When we also provide SSL we have to listen to the 
     # standard HTTPS port in addition.
    ##Listen 443 https

     SSLPassPhraseDialog exec:/usr/libexec/httpd-ssl-pass-dialog

     SSLSessionCache         shmcb:/run/httpd/sslcache(512000)
     SSLSessionCacheTimeout  300

      #
     SSLCryptoDevice builtin
     #SSLCryptoDevice ubsec

    ##
     ## SSL Virtual Host Context
    ##
     <VirtualHost _default_:443>

     # General setup for the virtual host, inherited from global configuration
   #DocumentRoot "/var/www/html"
    #ServerName www.example.com:443
    ServerName stcvxbb01test.mydomain.com:443                                         
   ProxyRequests Off
    ProxyVia Off
    ProxyPreserveHost On
       SSLProxyEngine on
       
         <Proxy *>
         Require all granted
        Order deny,allow
        Allow from all
        </Proxy>

   <IfModule mod_proxy.c>
      ProxyPass /bitbucket http://stcvxbb01test.mydomain.com:7990/bitbucket
     ProxyPassReverse /bitbucket http://stcvxbb01test.mydomain.com:7990/bitbucket
    </IfModule>                  
    RemoteIPHeader X-Forwarded-For

  # Use separate log files for the SSL virtual host; note that LogLevel
     # is not inherited from httpd.conf.
   ErrorLog logs/ssl_error_log
      TransferLog logs/ssl_access_log
    LogLevel warn

    #   SSL Engine Switch:
   #   Enable/Disable SSL for this virtual host.
 SSLEngine on

  #   List the protocol versions which clients are allowed to connect with.
    #   The OpenSSL system profile is used by default.  See
  #   update-crypto-policies(8) for more details. By default SSLv2 access is disabled
 #SSLProtocol all -SSLv3
#SSLProxyProtocol all -SSLv2 -SSLv3

 SSLHonorCipherOrder on

 #SSLCipherSuite HIGH:3DES:!aNULL:!MD5:!SEED:!IDEA
 SSLCipherSuite PROFILE=SYSTEM
 SSLProxyCipherSuite PROFILE=SYSTEM

 ##Server certificate
  SSLCertificateFile /etc/pki/tls/certs/stcvxbb01test-SAN.cer
  #   Server Private Key:
 SSLCertificateKeyFile /etc/pki/tls/private/stcvxbb01test-SAN.key

#   Server Certificate Chain:
#SSLCertificateChainFile /etc/pki/tls/certs/server-chain.crt

#   Certificate Authority (CA):
#SSLCACertificateFile /etc/pki/tls/certs/ca-bundle.crt
 #   Client Authentication (Type):
#SSLVerifyClient require
#SSLVerifyDepth  10
#   Access Control:
 #   for more details.
 #<Location />
  #SSLRequire (    %{SSL_CIPHER} !~ m/^(EXP|NULL)/ \
  #            and %{SSL_CLIENT_S_DN_O} eq "Snake Oil, Ltd." \
   #            and %{SSL_CLIENT_S_DN_OU} in {"Staff", "CA", "Dev"} \
   #            and %{TIME_WDAY} >= 1 and %{TIME_WDAY} <= 5 \
   #            and %{TIME_HOUR} >= 8 and %{TIME_HOUR} <= 20       ) \
   #           or %{REMOTE_ADDR} =~ m/^192\.76\.162\.[0-9]+$/
   #</Location>

#   SSL Engine Options:
#SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire
<FilesMatch "\.(cgi|shtml|phtml|php)$">
  SSLOptions +StdEnvVars
</FilesMatch>
<Directory "/var/www/cgi-bin">
   SSLOptions +StdEnvVars
</Directory>

 #   SSL Protocol Adjustments:
  BrowserMatch "MSIE [2-5]" \
     nokeepalive ssl-unclean-shutdown \
     downgrade-1.0 force-response-1.0

#   Per-Server Logging:
#   The home of a custom SSL log file. Use this when you want a
#   compact non-error SSL logfile on a virtual host basis.
 CustomLog logs/ssl_request_log \ "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

</VirtualHost>`

trying to achieve redirection from http to https on bitbucket server

om joshi
  • 13
  • 2

1 Answers1

0

Check your HTTP virtual host configuration for redirection. Make sure it's set to redirect HTTP requests to HTTPS:

<VirtualHost *:80>
    ServerName http://stcvxbb01test.mydomain.com
    Redirect permanent / https://stcvxbb01test.mydomain.com:443
</VirtualHost>

  1. After making changes to your configuration files, reload or restart Apache to apply the changes.
  2. Clear browser cache & check Apache access logs to see if requests hitting port 80 are redirected as intended.
  3. Verify your HTTPS configuration (<VirtualHost *:443>) is correctly set up to handle requests after redirection.
  4. SSL certificate and key files are correctly specified & accessible.
  5. Ensure DNS resolution works for both http://stcvxbb01test.mydomain.com & https://stcvxbb01test.mydomain.com.
  6. If proxying to Bitbucket, ensure your proxy settings & Bitbucket URL are correct. + Review proxy error logs for issues if proxying isn't working as expected.
  7. Test accessing https://stcvxbb01test.mydomain.com directly to check HTTPS setup.

Note: Divide the troubleshooting process into smaller steps to identify the specific issue area to get the result.

#Apache-Age #bitbucket-server

saima ali
  • 133
  • 9