Last active
December 13, 2016 23:03
-
-
Save tianon/c5ae888200d6426b167d4961d088dee2 to your computer and use it in GitHub Desktop.
configuration behind go.tianon.xyz, inspired by https://twitter.com/jessfraz/status/782333853117448192
This file contains hidden or 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
# inspired by https://twitter.com/jessfraz/status/782333853117448192 | |
# https://gist.github.com/jessfraz/421918a367a71dbaf72fdc772d809f61 | |
# https://gist.github.com/tianon/c5ae888200d6426b167d4961d088dee2 | |
server { | |
listen 80; | |
listen 443 ssl http2; | |
server_name go.tianon.xyz; | |
# https://github.com/infosiftr/nginx-conf.d/blob/26cea486152c658f33358f52610c9a105a264c14/set-proto.include | |
include conf.d/set-proto.include; | |
location ~ ^/([^/]+)(.*) { | |
# https://github.com/infosiftr/nginx-conf.d/blob/26cea486152c658f33358f52610c9a105a264c14/force-proto.include | |
set $force_proto "https"; | |
include conf.d/force-proto.include; | |
if ($args = "go-get=1") { | |
add_header Content-Type text/html; | |
return 200 '<meta name="go-import" content="$host/$1 git https://github.com/tianon/go-$1.git">'; | |
} | |
return 302 https://godoc.org/$host/$1$2; | |
} | |
location / { | |
# https://github.com/infosiftr/nginx-conf.d/blob/26cea486152c658f33358f52610c9a105a264c14/force-proto.include | |
set $force_proto "https"; | |
include conf.d/force-proto.include; | |
return 302 https://github.com/tianon?tab=repositories&q=go&type=source&language=go; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment