#
# jenkins.sbc.capital:80
#
<VirtualHost *:80>

    Redirect "/" "https://jenkins.sbc.capital"
    ServerName   "jenkins.sbc.capital:80"
    DocumentRoot "${DOCROOT_WWW}/sbc-capital-jenkins"
    ErrorLog     "${APACHE_LOG_DIR}/sbc-capital-jenkins-error_log"
    CustomLog    "${APACHE_LOG_DIR}/sbc-capital-jenkins-access_log" common

</VirtualHost>
# 
# jenkins.sbc.capital:443
# 
<IfModule mod_ssl.c>
    <VirtualHost *:443>

        ServerName   "jenkins.sbc.capital:443"
        ErrorLog     "${APACHE_LOG_DIR}/sbc-capital-jenkins-error_log"
        CustomLog    "${APACHE_LOG_DIR}/sbc-capital-jenkins-access_log" combined

        # Enable SSL
        SSLEngine on
        SSLCertificateFile    "${DOCROOT_WWW}/sbc.capital.crt"
        SSLCertificateKeyFile "${DOCROOT_WWW}/sbc.capital.key"

        # Proxy configuration
        ProxyRequests       Off
        ProxyPreserveHost   On
        AllowEncodedSlashes NoDecode

        <Proxy *>
            Order deny,allow
            Allow from all
        </Proxy>

        ProxyPass         /  http://sbc-capital-jenkins:8080/ nocanon
        ProxyPassReverse  /  http://sbc-capital-jenkins:8080/
        ProxyPassReverse  /  https://jenkins.sbc.capital/

        RequestHeader set X-Forwarded-Proto "https"
        RequestHeader set X-Forwarded-Port "443"
        Header always set X-Frame-Options "SAMEORIGIN"
        # Header unset X-Frame-Options

        # Required for Jenkins websocket agents
        RewriteEngine on
        RewriteCond %{HTTP:Upgrade} websocket [NC]
        RewriteCond %{HTTP:Connection} upgrade [NC]
        RewriteRule ^/?(.*) "ws://sbc-capital-jenkins:8080/$1" [P,L]

    </VirtualHost>
</IfModule>

# <IfModule mod_ssl.c>
#     <VirtualHost *:443>

#         ServerName   "jenkins.sbc.capital:443"
#         ErrorLog     "${APACHE_LOG_DIR}/sbc-capital-jenkins-error_log"
#         CustomLog    "${APACHE_LOG_DIR}/sbc-capital-jenkins-access_log" combined

#         # Enable SSL
#         SSLEngine on
#         SSLCertificateFile    "${DOCROOT_WWW}/sbc.capital.crt"
#         SSLCertificateKeyFile "${DOCROOT_WWW}/sbc.capital.key"

#         # Proxy configuration
#         ProxyRequests       Off
#         ProxyPreserveHost   On
#         AllowEncodedSlashes NoDecode

#         <Proxy *>
#             Order deny,allow
#             Allow from all
#         </Proxy>

#         <Location /jenkins/>
#             ProxyPassReverse /
#             Order deny,allow
#             Allow from all
#         </Location>

#         ProxyPass         /jenkins  http://sbc-capital-jenkins:8080/jenkins nocanon
#         ProxyPassReverse  /jenkins  http://sbc-capital-jenkins:8080/jenkins
#         ProxyPassReverse  /jenkins  https://jenkins.sbc.capital/jenkins

#         RequestHeader set X-Forwarded-Proto "https"
#         RequestHeader set X-Forwarded-Port "443"
#         Header always set X-Frame-Options "SAMEORIGIN"
#         # Header unset X-Frame-Options

#         # Required for Jenkins websocket agents
#         RewriteEngine on
#         RewriteCond %{HTTP:Upgrade} websocket [NC]
#         RewriteCond %{HTTP:Connection} upgrade [NC]
#         RewriteRule ^/?(.*) "ws://sbc-capital-jenkins:8080/$1" [P,L]

#     </VirtualHost>
# </IfModule>


