当前位置:网站首页>Openresty rewrites the location of 302
Openresty rewrites the location of 302
2022-07-01 04:38:00 【tuhoooo】
introduction
This paper introduces the use of openresty modify 302 Methods for redirecting addresses and parameters , Be able to deal with the problem of inconsistent internal and external network access ;openresty Integrated lua And many practical tools and templates , Than nginx It should be more convenient ;proxy_redirect The drawback is that you can only modify the domain name and port , Can't cope well with complex situations .
Original address : http://blog.duhbb.com/2022/02/15/usage-of-openresty-in-rewriting-302-location/
Welcome to my blog : http://blog.duhbb.com/
Problem solved
Hey , openresty It's really an artifact , YYDS!
Above use lua modify nginx 302 Reset backward Location, To cause to Location The Intranet in becomes the address accessed by the Internet .
The counterpart is :
body_filter_by_lua
- Get the response data of all requests
- Sensitive information detection for all requested response data
- Sensitive data detected returned , Conduct desensitization before responding
Be careful :
- The document says body_filter_by_lua May be called multiple times in one request
- When the code runs to body_filter_by_lua when ,HTTP Headlines (header) It's already sent . If the header related to the response body is set before , And body_filter_by_lua The response body is modified in , This will cause inconsistency between the response header and the actual response . A simple example : Suppose the upstream server returns Content-Length Headlines , and body_filter_by_lua The actual size of the response body is also modified . After the client receives this header , If you press Content-Length To deal with , Then he will fall into the pit . because Nginx Streaming response of , The headlines are like water thrown out , You can only modify it in advance .OpenResty Provide with body_filter_by_lua Corresponding header_filter_by_lua.
Reference documents
- https://blog.csdn.net/weixin_33734785/article/details/89124813
- https://blog.csdn.net/ygm_linux/article/details/81563129
- https://blog.csdn.net/wtswjtu/article/details/38898945
- https://zhuanlan.zhihu.com/p/67904411
Conclusion
This paper introduces the use of openresty modify 302 Methods for redirecting addresses and parameters , Be able to deal with the problem of inconsistent internal and external network access ;openresty Integrated lua And many practical tools and templates , Than nginx It should be more convenient ;proxy_redirect The drawback is that you can only modify the domain name and port , Can't cope well with complex situations .
Original address : http://blog.duhbb.com/2022/02/15/usage-of-openresty-in-rewriting-302-location/
Welcome to my blog : http://blog.duhbb.com/
边栏推荐
- Ten wastes of software research and development: the other side of research and development efficiency
- Qt development experience tips 226-230
- Daily algorithm & interview questions, 28 days of special training in large factories - the 13th day (array)
- Chen Yu (Aqua) - Safety - & gt; Cloud Security - & gt; Multicloud security
- JMeter learning notes 2 - brief introduction to graphical interface
- [difficult] sqlserver2008r2, can you recover only some files when recovering the database?
- Embedded System Development Notes 79: why should I get the IP address of the local network card
- Execution failed for task ‘:app:processDebugResources‘. > A failure occurred while executing com. and
- 2022 gas examination question bank and online simulation examination
- 2022年T电梯修理题库及模拟考试
猜你喜欢
Rule method: number of effective triangles
slf4j 简单实现
Jenkins automatically cleans up construction history
Task04 | statistiques mathématiques
Odeint et GPU
2022 polymerization process test questions and simulation test
Coinbase in a bear market: losses, layoffs, stock price plunges
After many job hopping, the monthly salary is equal to the annual salary of old colleagues
Question bank and online simulation examination for special operation certificate of G1 industrial boiler stoker in 2022
Unity's 3D multi-point arrow navigation
随机推荐
什么是权限?什么是角色?什么是用户?
使用WinMTR软件简单分析跟踪检测网络路由情况
How to view the changes and opportunities in the construction of smart cities?
Possible problems and solutions of using scroll view to implement slider view
How do I sort a list of strings in dart- How can I sort a list of strings in Dart?
嵌入式系统开发笔记79:为什么要获取本机网卡IP地址
Maixll-Dock 使用方法
Registration for R2 mobile pressure vessel filling test in 2022 and R2 mobile pressure vessel filling free test questions
Web server: how to choose a good web server these five aspects should be paid attention to
2022 G2 power station boiler stoker examination question bank and G2 power station boiler stoker simulation examination question bank
TCP server communication flow
扩展-Fragment
Leetcode learning - day 36
[ue4] event distribution mechanism of reflective event distributor and active call event mechanism
MySQL winter vacation self-study 2022 12 (5)
什么是uid?什么是Auth?什么是验证器?
Measurement of quadrature axis and direct axis inductance of three-phase permanent magnet synchronous motor
Odeint and GPU
2022 tea master (intermediate) examination question bank and tea master (intermediate) examination questions and analysis
JVM栈和堆简介