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