# <VirtualHost *:80>

# ServerAdmin admin@example.com
# Servername hostname

# ServerAdmin admin@example.com
# Servername hostname
# DocumentRoot /var/www/html/

#         <Location /redmine>
#                 RailsEnv production
#                 RackBaseURI /redmine
#                 Options -MultiViews
#         </Location>
# ProxyPass         /jenkins  http://localhost:8180/jenkins nocanon
# ProxyPassReverse  /jenkins  http://localhost:8180/jenkins

# ProxyPass         /api  http://localhost:8080/api nocanon
# ProxyPassReverse  /api  http://localhost:8080/api

# ProxyRequests     Off
# AllowEncodedSlashes NoDecode

# <Proxy http://localhost:8180/jenkins>
#   Order deny,allow
#   Allow from all
# </Proxy>

# <Proxy http://localhost:8080/api>
#   Order deny,allow
#   Allow from all
# </Proxy>

# </VirtualHost>

<VirtualHost *:80>

ServerAdmin admin@example.com
Servername hostname
DocumentRoot /var/www/html/

        <Location /redmine>
                RailsEnv production
                RackBaseURI /redmine
                Options -MultiViews
        </Location>

Redirectpermanent / https://integration.docnshare.com/

</VirtualHost>

<VirtualHost *:443>

ServerAdmin admin@example.com
Servername hostname
DocumentRoot /var/www/html/

        <Location /redmine>
                RailsEnv production
                RackBaseURI /redmine
                Options -MultiViews
        </Location>
ProxyPass         /jenkins  http://localhost:8180/jenkins nocanon
ProxyPassReverse  /jenkins  http://localhost:8180/jenkins
ProxyPassReverse  /jenkins  http://integration.docnshare.com/jenkins
# MyNetData - monitoring server
ProxyPass         /monitoring http://localhost:19999/ nocanon
ProxyPassReverse  /monitoring http://localhost:19999/

# SMTP4Dev
ProxyPass         /mail http://localhost:5000/ nocanon
ProxyPassReverse  /mail http://localhost:5000/

ProxyPass         /dist http://localhost:5000/dist nocanon
ProxyPassReverse  /dist http://localhost:5000/dist
<Location /api>
ProxyPass          http://localhost:8080/api nocanon
ProxyPassReverse   http://localhost:8080/api
AllowOverride All
SetEnv proxy-chain-auth toto
Order Deny,Allow
    Allow from All
    Satisfy Any
</Location>


ProxyRequests     Off
ProxyPreserveHost On
AllowEncodedSlashes NoDecode

# directives obligatoires pour TLS
SSLEngine on
Header always set Strict-Transport-Security "max-age=15768000"

RequestHeader set X-Forwarded-Proto "https"
RequestHeader set X-Forwarded-Port "443"
# Local reverse proxy authorization override
# Most unix distribution deny proxy by default (ie /etc/apache2/mods-enabled/proxy.conf in Ubuntu)
<Proxy http://localhost:8180/jenkins>
  Order deny,allow
  Allow from all
</Proxy>

#<Proxy http://localhost:8080/api>
#SetEnv proxy-chain-auth toto
#SetEnvIf Authorization "(.*)" HTTP_AUTHORIZATION=$1
#RequestHeader set Authorization "%{proxy-chain-auth}e" env=HTTP_AUTHORIZATION 
#</Proxy>

ServerAlias integration.docnshare.com
SSLCertificateFile /etc/letsencrypt/live/integration.docnshare.com/fullchain.pem 
SSLCertificateKeyFile /etc/letsencrypt/live/integration.docnshare.com/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
</VirtualHost>

