惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
G
Google Developers Blog
B
Blog
Engineering at Meta
Engineering at Meta
阮一峰的网络日志
阮一峰的网络日志
The Register - Security
The Register - Security
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 叶小钗
The Cloudflare Blog
The Hacker News
The Hacker News
D
Darknet – Hacking Tools, Hacker News & Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
雷峰网
雷峰网
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
H
Hackread – Cybersecurity News, Data Breaches, AI and More
酷 壳 – CoolShell
酷 壳 – CoolShell
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
A
About on SuperTechFans
量子位
Recorded Future
Recorded Future
博客园 - 三生石上(FineUI控件)
H
Help Net Security
Help Net Security
Help Net Security
P
Palo Alto Networks Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Troy Hunt's Blog
W
WeLiveSecurity
V
Vulnerabilities – Threatpost
T
The Exploit Database - CXSecurity.com
Know Your Adversary
Know Your Adversary
Apple Machine Learning Research
Apple Machine Learning Research
Scott Helme
Scott Helme
N
News | PayPal Newsroom
AWS News Blog
AWS News Blog
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
腾讯CDC
J
Java Code Geeks
Microsoft Azure Blog
Microsoft Azure Blog
TaoSecurity Blog
TaoSecurity Blog
GbyAI
GbyAI
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
Docker

OpenResty

分享一个在 openresty 搭建 long polling 推送服务的配置文件 - V2EX 云原生网关 Kong 源码分析 - V2EX v2 有没有用 openresty 开发的? 用 Nginx Openresty 写个网站,写得很痛苦 - V2EX 这个节点这么冷清? - V2EX [赠票活动 / 北京] BearyChat 邀请你一起参加 OpenResty Con 2015 - V2EX OpenResty 目前有没有在稳定维护中的 PPA? - V2EX OpenResty 中有 openssl_sign() 的实现么? - V2EX 一个可以调试 OpenResty 的 Lua 代码的 IDE - V2EX
OpenResty 使用 ngx_balancer.set_current_peer() 方法不能设置域名,那对于转发到某个域名的情况要怎么做? - V2EX
Lpl · 2020-10-30 · via OpenResty

文档地址: https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/balancer.md#set_current_peer

syntax: ok, err = balancer.set_current_peer(host, port)

context: balancer_by_lua*

Sets the peer address (host and port) for the current backend query (which may be a retry).

Domain names in host do not make sense. You need to use OpenResty libraries like lua-resty-dns to obtain IP address(es) from all the domain names before entering the balancer_by_lua* handler (for example, you can perform DNS lookups in an earlier phase like access_by_lua* and pass the results to the balancer_by_lua* handler via ngx.ctx.

按照正常 nginx 的逻辑,upstream 中是可以写域名的。此处 OpenResty 文档说不能写域名,但是可以用 DNS 把域名的 IP 解析出来。

解析 IP 的方式在明显不符合需求,假如我有个 test.com 的域名,指向了某个 IP 。这个 IP 是个 nginx,根据 server_name 来区分请求。如果是通过 IP 转发过来的请求,请求头里边是没有 Host 的,所以请求并不能正常转发。

目前不考虑使用 recreate_request 方法来做,有没有什么办法解决这个问题?