Created
October 1, 2016 21:37
-
-
Save jessfraz/421918a367a71dbaf72fdc772d809f61 to your computer and use it in GitHub Desktop.
nginx go-get vanity urls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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