Set the scheme from YT_POT_BGUTIL_BASE_URL

This commit is contained in:
tcely 2025-05-16 22:11:42 -04:00 committed by GitHub
parent 5f797d0915
commit 0919b03143
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,8 +11,18 @@ server {
# Server domain name # Server domain name
server_name _; server_name _;
set_by_lua_block $pot_url_scheme {
local haystack = os.getenv('YT_POT_BGUTIL_BASE_URL') or ''
local needle = 'https://'
local scheme = 'http'
if haystack:sub(1, #needle) == needle then
scheme = 'https'
end
return scheme
}
location / { location / {
proxy_pass http://token_server; proxy_pass $pot_url_scheme://token_server;
proxy_redirect default; proxy_redirect default;
} }
} }