AWS ALB的代理通行证

发布于 2025-02-13 16:35:48 字数 1034 浏览 1 评论 0原文

我有一个安装了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:

enter image description here

Is this even possible? This cannot be a simple web url rewrite because client needs a response from the API Server. Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

太傻旳人生 2025-02-20 16:35:48

经过大量探索,我发现这是不可能的。解决方案是将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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文