回答
收藏
分享
举报
请教大佬们,【域名相同】的请求,根据【不同参数】请求【不同ip】,有什么姿势可以办到
提问于2021-09-06 16:14

浏览 3.1k

例如
baidu.com/inner
baidu.com

根据 url 中 是否包含 inner 访问不同ip

已修改于2023-03-15 02:24



写下您的回答
发表回答
全部回答(1)

按点赞数排序

按时间排序

这个单纯在server、location级别是做不到的,因为只有建立连接后才能获取http报文,解析出uri。

可以使用反向代理,提取变量再转发,但这个也许不一定满足你的要求。

赞同

1

回复举报

回答于2021-09-08 15:22



回复罗剑锋
回复
扬尘回复了

感谢大佬解惑

0

回复举报

回答于2021-09-08 07:56



回复扬尘
回复
提问者
扬尘
这家伙很懒还未留下介绍~
0
文章
1
问答
0
粉丝
相关问答

Nginx涉及的业务场景很多,面试官可以问的点太多了,要看他的经验偏向哪块,如果有条件,可以先打听下他做过哪些业务。

我简单总结下,Nginx大概可以问这几个方向:

1、基本配置,比如server_name、location的匹配,rewrite的重定向规则,if有哪些陷井等。

2、反向代理,比如一致性hash算法该怎么配,keepalive请求有什么问题,如果上游挂了,怎么换一台新上游,但不给用户返回错误?

3、缓存类,比如过期缓存怎么配,合并回源怎么弄,cache manager、cache loader工作模式等

4、针对WAF防火墙等应用场景,可以展开了问HTTP协议的知识,比如POST请求的处理,比如tailer头部的处理等。

5、进程维护,包括热加载、热升级、切割日志文件、日志压缩等。

6、静态资源,比如root/alias的区别,比如aio/sendfile的选择等。

7、如果是做C模块开发的团队,会问很多源码、实现层面的问题。

8、如果偏向Openresty的团队,会问很多Lua模块的用法,特别是Lua原生函数与ngx库的使用。

9、TLS/SSL,比如对下游、上游怎么开启TLS,对HTTP、TCP怎么开启,怎么传递域名、IP地址等


并不全面,仅供参考哈

点赞 0
浏览 5k

第1种。参考官方文档:

“When buffering is enabled, nginx receives a response from the proxied server as soon as possible, saving it into the buffers set by the proxy_buffer_size and proxy_buffers directives. If the whole response does not fit into memory, a part of it can be saved to a temporary file on the disk. Writing to temporary files is controlled by the proxy_max_temp_file_size and proxy_temp_file_write_size directives.

When buffering is disabled, the response is passed to a client synchronously, immediately as it is received. nginx will not try to read the whole response from the proxied server. The maximum size of the data that nginx can receive from the server at a time is set by the proxy_buffer_size directive.”

点赞 0
浏览 3.5k

nginx版本试过1.16.1和1.20.1

点赞 0
浏览 3.7k