Skip to content
Home / Apache / Minimal working example of Apache Jenkins public exposure

Minimal working example of Apache Jenkins public exposure

Just enough minimal setup for Apache 2 to expose Jenkins instance to public.

AllowEncodedSlashes NoDecode and nocanon options are important for Jenkins running smoothly.

<VirtualHost *:80>
    ServerName jenkins.example.com
    ProxyRequests     Off
    ProxyPreserveHost On
    AllowEncodedSlashes NoDecode
    <Proxy http://localhost:8080/>
      Order deny,allow
      Allow from all
    </Proxy>
    ProxyPass         /  http://localhost:8080/ nocanon
    ProxyPassReverse  /  http://localhost:8080/
    ProxyPassReverse  /  http://jenkins.example.com
    <IfModule mod_headers.c>
       Header always set Strict-Transport-Security "max-age=15552000; includeSubDomains"
       Header edit Set-Cookie ^(.*)$ "$1;HttpOnly;Secure;SameSite=Strict"
    </IfModule>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>