当前位置:网站首页>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/
边栏推荐
- 2022 t elevator repair question bank and simulation test
- VIM简易使用教程
- Maixll-Dock 使用方法
- Strategic suggestions and future development trend of global and Chinese vibration isolator market investment report 2022 Edition
- Rule method: number of effective triangles
- 2. Use of classlist (element class name)
- Simple implementation of slf4j
- Redis (VII) optimization suggestions
- 2022 a special equipment related management (elevator) simulation test and a special equipment related management (elevator) certificate examination
- In the innovation community, the "100 cities Tour" of the gold warehouse of the National People's Congress of 2022 was launched
猜你喜欢

The junior college students were angry for 32 days, four rounds of interviews, five hours of soul torture, and won Ali's offer with tears
![[learn C and fly] S1E20: two dimensional array](/img/68/34fad73ff23d3e0719ef364fc60cb5.jpg)
[learn C and fly] S1E20: two dimensional array

2022年上海市安全员C证考试题模拟考试题库及答案

2022年聚合工艺考试题及模拟考试

JD intelligent customer service Yanxi intention system construction and intention recognition technology introduction

LM小型可编程控制器软件(基于CoDeSys)笔记二十:plc通过驱动器控制步进电机

2022年煤气考试题库及在线模拟考试

2022年G1工业锅炉司炉特种作业证考试题库及在线模拟考试

VR线上展览所具备应用及特色

Dual Contrastive Learning: Text Classification via Label-Aware Data Augmentation 阅读笔记
随机推荐
JD intelligent customer service Yanxi intention system construction and intention recognition technology introduction
2022年T电梯修理题库及模拟考试
Dual contractual learning: text classification via label aware data augmentation reading notes
ThreeJS开篇
Collect the annual summary of laws, regulations, policies and plans related to trusted computing of large market points (national, ministerial, provincial and municipal)
MySQL function variable stored procedure
Browser top loading (from Zhihu)
Strategic suggestions and future development trend of global and Chinese vibration isolator market investment report 2022 Edition
嵌入式系统开发笔记80:应用Qt Designer进行主界面设计
What is uid? What is auth? What is a verifier?
[human version] Web3 privacy game in the dark forest
Simple implementation of slf4j
PgSQL failed to start after installation
【深度学习】(4) Transformer 中的 Decoder 机制,附Pytorch完整代码
Haskell lightweight threads overhead and use on multicores
Threejs opening
扩展-Fragment
OSPF notes [multiple access, two multicast addresses with OSPF]
2022 t elevator repair question bank and simulation test
Odeint et GPU