简体   繁体   中英

How to handle Nginx internal request or not

I use nginx as proxy server and I just set proxy_intercept_errors on; and also error_page directive error_page 400 /400.html; location = /400.html { root /path/to/error; } error_page 400 /400.html; location = /400.html { root /path/to/error; } error_page 400 /400.html; location = /400.html { root /path/to/error; } .

So the backend server which is tomcat(servlet) sometimes sendError likes HttpServletResponse.sendError(404); , that request may come back to nginx and redirect to 400.html.

In this situation I need to handle the internal redirect to 400.

My problem is I use a lua script which is checking some stuff from all income request, so I need to tell my lua to skip check when internal request is come.

Is it possible to identify internal request?

The below ngx.req.is_internal() is the answer.

https://github.com/openresty/lua-nginx-module#ngxreqis_internal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM