AWS ALB的代理通行证
我有一个安装了NGINX的EC2实例,并且一个简单的配置类似:
server_name server_1.domain.com;
location / {
proxy_pass https://api.domain.cloud:8200/;
}
当我进行get请求时> http://server_1.domain.com/some/path 我正确地转发到Api.domain.Cloud:8200,但它以 https://server_1.domain.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some.com/some. /路径和世界很有意义。
如何以类似的方式设置AWS ALB?当我只能使用ALB/NLB时,我真的不想管理EC2实例。当我尝试在AWS Alb中进行设置时,它不会掩盖域,而是尝试fwd to http:// /PI.DOMAIN.CLOUD:8200 此URL只能在AWS中内部解决
这是我的ALB:
这甚至可能吗?这不能是一个简单的Web URL重写,因为客户端需要API服务器的响应。谢谢
I have an EC2 Instance with NGINX installed and a simple config like so:
server_name server_1.domain.com;
location / {
proxy_pass https://api.domain.cloud:8200/;
}
When I do a GET request to http://server_1.domain.com/some/path I get forwarded correctly to api.domain.cloud:8200 but it masks the domain as https://server_1.domain.com/some/path and the world makes sense.
How can I setup an AWS ALB in a similar way? I really don't wanna manage an EC2 Instance when I can just use an ALB/NLB. When I try to set this up in AWS ALB it does NOT mask the domain but instead tries to fwd to the http://api.domain.cloud:8200 and this URL is only able to resolve internally in AWS
This is my config for the ALB:
Is this even possible? This cannot be a simple web url rewrite because client needs a response from the API Server. Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过大量探索,我发现这是不可能的。解决方案是将API网关放在网络负载平衡器的前面。 API网关充当代理,并为我解决了问题。很高兴与对此感兴趣的任何人分享我的解决方案。
After much exploring I found out that this is not possible. The solution was to put an API Gateway in front of an Network Load Balancer. The API Gateway acts as a Proxy and resolved the issue for me. Happy to share my solution with anyone who is interested in the same.