是否可以使用aws elb转发路径的仅一部分? [英] Is it possible to forward only part of a path using aws elb?

查看:286
本文介绍了是否可以使用aws elb转发路径的仅一部分?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在我的ALB中创建规则,因此路径的某些部分没有转发到目标.因此,例如,我的基础服务可能会接受类似的呼叫

I am trying to create rules in my ALB so there are parts of the path that I do not forward on to the target. So for example, my underlying service may accept a call like

获取 http://主机名/狗

但是在ALB中,我可能会在路径中添加一个版本以进行路由:

But in the ALB I might add a version to the path for routing purposes:

获取 http://hostname/v1/dogs

或者我可以打电话

获取 http://hostname/v2/dogs

两个版本将在不同的目标组中运行.我当时想我可以删除版本部分,以便我的应用程序不必关心版本控制.但是,我如何处理它尚不明确,而且似乎也不可能.

Both versions would be running in different target groups. I was thinking I could then drop the version part off so that my application doesn't have to be concerned with versioning. However, it's not obvious how I might handle that and it doesn't appear to be possible.

推荐答案

Application Load Balancer当前不支持此功能.

This is not something that is currently supported by Application Load Balancer.

CloudFront的设置名为

CloudFront, however, has a setting called Origin Path that is prepended to the request URI before sending the request to the origin server -- in this case, the origin ALB -- so you'd set the origin path to /v1 if you wanted example.com/dogs to be sent to the ALB as example.com/v1/dogs. CloudFront is a CDN but it has a number of other purposes, such as request rewriting -- it's essentially a massive, globally-distributed reverse proxy with a cache, and supports dynamic as well as static content. More complex rewrites require Lambda@Edge in addition to CloudFront, but prepending a string to certain request path patterns is part of the base feature set.

这篇关于是否可以使用aws elb转发路径的仅一部分?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆