Skip to content

Instantly share code, notes, and snippets.

@jessfraz
Created October 1, 2016 21:37
Show Gist options
  • Save jessfraz/421918a367a71dbaf72fdc772d809f61 to your computer and use it in GitHub Desktop.
Save jessfraz/421918a367a71dbaf72fdc772d809f61 to your computer and use it in GitHub Desktop.
nginx go-get vanity urls
server {
....
location ~ ^/x/(.*) {
if ($args = "go-get=1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="$host/x/$1 git https://github.com/jessfraz/$1.git">';
}
return 302 https://github.com/jessfraz/$1;
}
location ~ ^/x/(.*)$ {
if ($args = "go-get=1") {
add_header Content-Type text/html;
return 200 '<meta name="go-import" content="$host/x/$1 git https://github.com/jessfraz/$1.git">';
}
return 302 https://github.com/jessfraz/$1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment