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

推荐订阅源

T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
O
OpenAI News
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cisco Blogs
AWS News Blog
AWS News Blog
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
美团技术团队
T
Threatpost
S
Schneier on Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Last Week in AI
Last Week in AI
C
CERT Recently Published Vulnerability Notes
Blog — PlanetScale
Blog — PlanetScale
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
博客园_首页
N
Netflix TechBlog - Medium
Security Latest
Security Latest
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Announcements
Recent Announcements
博客园 - Franky
P
Palo Alto Networks Blog
Project Zero
Project Zero
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Cisco Talos Blog
Cisco Talos Blog
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 【当耐特】
GbyAI
GbyAI

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 方法来做,有没有什么办法解决这个问题?