简体   繁体   English

连接到 AWS ECS 上不同 docker 容器中的 spring-boot 应用程序的错误请求

[英]Bad Request Connecting to a spring-boot app in a different docker container on AWS ECS

My Halloween question of the day:我今天的万圣节问题:

I'm trying to deploy an app in AWS ECS using two containers, one frontend app wrote in nodejs and a backend app wrote as spring-boot app.我正在尝试使用两个容器在 AWS ECS 中部署一个应用程序,一个前端应用程序用 nodejs 编写,一个后端应用程序编写为 spring-boot 应用程序。 Only the frontend app will be exposed and all requests to rest apis will be proxied to backend.只有前端应用程序将被公开,并且对 rest apis 的所有请求都将被代理到后端。

Both containers are running and I can reach the backend from the frontend api but I get a bad request when I use curl to access the backend, for example:两个容器都在运行,我可以从前端 api 到达后端,但是当我使用 curl 访问后端时,我收到了一个错误的请求,例如:

curl http://BACKEND_SERVER:8080/api/config

However, if I try the same using telnet like the following example bellow, it works但是,如果我像下面的示例一样使用 telnet 尝试相同的操作,它可以工作

telnet BACKEND_SERVER 8080
GET /api/config

Not strange enough, if I use HTTP/1.1, it doesn't work again.不够奇怪,如果我使用 HTTP/1.1,它就不能再工作了。

telnet BACKEND_SERVER 8080
GET /api/config

curl works fine both from the host and from the container itself, only fails when run from the frontend container... curl 从主机和容器本身都可以正常工作,只有在从前端容器运行时才会失败......

Any idea?任何想法?

If only the frontend app is exposed.如果只暴露前端应用程序。 I suppose that backend app is in a private subnet.我想后端应用程序位于私有子网中。 Check the security groups of the subnets if they have the input and output protocols.检查子网的安全组是否有输入和output协议。 For example HTTP and HTTPS .例如HTTPHTTPS Just check all the outputs of subnets, security groups and instances beacause i can't see the specific error.只需检查子网、安全组和实例的所有输出,因为我看不到具体错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM