Skip to content

Instantly share code, notes, and snippets.

@ubergarm
Created June 4, 2014 20:44
Show Gist options
  • Save ubergarm/499e72241d02a5b82a58 to your computer and use it in GitHub Desktop.
Save ubergarm/499e72241d02a5b82a58 to your computer and use it in GitHub Desktop.
Dynamic Proxy nginx.conf

A top level redirect can be updated to point to the latest git ref Docker container.

location = / {
    rewrite ^/(.*) /abc1234/$1 redirect;
}

location ~ "^/([0-9a-zA-Z]{7})/.*$" {                                          
    set $target $1.myimage.dev.docker:5000;
    auth_basic off;
    proxy_pass         http://$target;
    proxy_redirect     off;
    proxy_read_timeout 90;
    proxy_set_header   Host $host;
    proxy_set_header   X-Real-IP $remote_addr;
    proxy_set_header   X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header   Authorization "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment