ollama / validate_api_key.lua
barisaydin's picture
Upload validate_api_key.lua
4464da3 verified
raw
history blame
306 Bytes
local valid_api_key = "c64033672f5ca984dfe962909671961e8012f0c5"
local headers = ngx.req.get_headers()
local api_key = headers["Authorization"]
if api_key ~= "Bearer " .. valid_api_key then
ngx.status = ngx.HTTP_UNAUTHORIZED
ngx.say("Unauthorized")
return ngx.exit(ngx.HTTP_UNAUTHORIZED)
end