Skip to content

Instantly share code, notes, and snippets.

@jessfraz
Created October 1, 2016 21:37
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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