gpt4 book ai didi

amazon-web-services - ELB可以根据URL重定向请求吗?

转载 作者:行者123 更新时间:2023-12-03 06:18:56 29 4
gpt4 key购买 nike

我正在尝试在 Amazon Elastic Load Balancer 后面设置我的应用程序服务器。我正在考虑让一台服务器专用于旧版本,所有其他服务器专用于新版本。我正在考虑在路径参数中使用版本 id 来实现这一点

例如

当前版本(3.0):http://example.com/APPNAME/service

旧版本(2.2):http://example.com/APPNAME/v2.2/service

我想知道:

  1. ELB 是否能够查看 HTTP 请求?
  2. ELB 能否根据 URL 路径参数重定向请求?

最佳答案

更新2017-04-05

去年夏天推出具有基于路径的路由支持的新应用程序负载均衡器(请参阅前面的更新)后,AWS 现在还添加了 Host-Based Routing Support for AWS Application Load Balancers :

[...] You can now create Application Load Balancer rules that route incoming traffic based on the domain name specified in the Host header. Requests to api.example.com can be sent to one target group, requests to mobile.example.com to another, and all others (by way of a default rule) can be sent to a third. You can also create rules that combine host-based routing and path-based routing. This would allow you to route requests to api.example.com/production and api.example.com/sandbox to distinct target groups.

更新2016-08-11

AWS 刚刚(2016 年 8 月 11 日)推出了新的 Application Load Balancer for the Elastic Load Balancing service ,旨在提高实时应用程序、微服务、基于容器的架构和流应用程序的灵 active 和性能:

This new load balancer, which also supports the WebSocket protocol and HTTP/2, operates at the application layer and provides content-based routing support. This allows the Application Load Balancer to route requests across multiple services or containers running on one or more Amazon Elastic Compute Cloud (Amazon EC2) instances, helping to reduce costs and simplify service discovery. [emphasis mine]

正如 introductory blog post 中所强调的那样,这个新的 ELB 应用程序负载均衡器选项在第 7 层运行并支持许多高级功能,而原始选项(现在称为经典负载均衡器)仍然可供您使用并继续提供第 4 层和第 7 层功能。

更具体地说,ELB 现在支持当前的场景,因为每个 Application Load Balancer 允许您定义最多 10 个基于 URL 的规则,以将请求路由到目标组(AWS 计划提供随着时间的推移,您可以访问其他路由方法。

<小时/>

初步回答

这是不可能的 - Amazon ELB主要(但见下文)提供传输层负载平衡(OSI第4层),其负载平衡决策仅基于TCP连接,但忽略应用程序负载。后者将允许应用程序层负载平衡(OSI第7层),其中应用程序负载确实被考虑到负载平衡决策。

Amazon ELB 中的默认配置实际上提供了对 HTTP/HTTPS/SSL 的基本应用程序级别支持(例如终止 SSL 连接和插入 X-Forwarded-* header ),但您无法调整此配置;换句话说,ELB 确实在这里查看 HTTP 请求,但是您无法控制 ELB 在这方面的行为。

这在Choosing Listeners for Your Load Balancer中有更详细的解释。 ,例如:

Using TCP/SSL (Layer 4) with Elastic Load Balancing

When you use TCP for both front-end and back-end connections, your load balancer will forward the request to the back-end instances without modification to the headers. This configuration will also not insert cookies for session stickiness or the X-Forwarded-* headers.

[...]

Using HTTP/HTTPS (Layer 7) with Elastic Load Balancing

When you use HTTP (layer 7) for both front-end and back-end connections, your load balancer parses the headers in the request and terminates the connection before re-sending the request to the registered instance(s). This is the default configuration provided by Elastic Load Balancing.

[emphasis mine]

Architectural Overview还提供了插图和更多详细信息。

关于amazon-web-services - ELB可以根据URL重定向请求吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10547246/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com