File size: 306 Bytes
4464da3
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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