Skip to content

Instantly share code, notes, and snippets.

@bloodearnest
Last active October 20, 2020 11:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bloodearnest/dbc5295eaec80d638da68c423123187f to your computer and use it in GitHub Desktop.
Save bloodearnest/dbc5295eaec80d638da68c423123187f to your computer and use it in GitHub Desktop.
Proxy ghcr.io with auth realm rewrite
map $upstream_http_www_authenticate $auth_header {
~(.*)ghcr.io(.*) $1example.com$2;
}
server {
server_name example.com
...
location / {
limit_except GET { deny all; }
proxy_pass https://ghcr.io;
proxy_hide_header www-authenticate;
add_header www-authenticate $auth_header always;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment