Skip to content

Instantly share code, notes, and snippets.

@chazcheadle
Created October 3, 2016 19:24
Show Gist options
  • Save chazcheadle/525cd1925b915181b70b840b602e5427 to your computer and use it in GitHub Desktop.
Save chazcheadle/525cd1925b915181b70b840b602e5427 to your computer and use it in GitHub Desktop.
Jenkins redirect in Varnish 4
# Jenkins
# This will allow you to run Jenkins as <HOST>/jenkins.
# Varnish 4 declaration
vcl 4.0;
# Backend is using the default Jenkins port.
backend jenkins {
.host = "127.0.0.1";
.port = "8080";
}
sub vcl_recv {
if (req.http.host == "<HOST>" && req.url ~ "/jenkins(/.*)") {
set req.url = regsub(req.url, "/jenkins(/.*)" , "\1");
set req.backend_hint = jenkins;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment