authentication - Nginx: Grant access by comparing a header value with the contents of a file; possible? -
Text after "
I have access to some stable file by comparing a custom header value with one example Actually I want to generate such a token in another (restricted) application and Nginx denied all requests with non matching header and header values (token). What I have read so far, along with it is possible that it is possible to enlarge the Engex writing Lea code. But I have no idea that my idea is working on any occasion. So, what is a simple solution using the standard NGNX module (Favorites)? Or re-install / module mentioned before, is the Lua module installed by nginx compilation including its own chance? You can easily do so by checking out the docs by Lua, as mentioned by Aki All you need is - just enter your logic in the request stage, such as:
location / {lua_need_request_body on; Client_max_body_size 100k; Client_body_buffer_size 100k; Access_by_lua '- Check the customer's IP address in our black list if ngx.var.remote_addr == "132.5.72.3" then ngx.exit (ngx.HTTP_FORBIDDEN) end-check request body if NGX is bad word or not. Var.request_body and string.match (ngx.var.request_body, "FSCc") then the ngx.redirect return ("/ terms_of_use.html") the local f = io.open ("/ tmp / foo") local token = f : Read ("a") local user_token = ngx.req.get_headers () ["user session-token"] if user_token or user_token ~ = tokens then passed ngx.exit (ngx.HTTP_FORBIDDEN) end-test ' ; #proxy_pass / fastcgi_pass / etc settings / request proceed and on this}
Comments
Post a Comment