Spring Boot REST API经Apache2代理部署至Azure Container Apps后代理转发失败的问题求助
Spring Boot REST API经Apache2代理部署至Azure Container Apps后代理转发失败的问题求助
各位好,我最近在将Java Spring Boot开发的REST API部署到Azure Container Apps(ACA)时,卡在了Apache2代理转发的环节,试了好多种配置调整都没搞定,想请教下有没有朋友碰到过类似场景或者能给点排查思路?
整体架构说明
我采用的是标准Web应用架构:
- 浏览器 → 443端口 → Apache2反向代理容器(ACA实例名
pct-datallama,开启外部 ingress) - Apache2容器 → 8080端口 → Spring Boot REST API容器(ACA实例名
datallama-api,仅开启内部 ingress) - REST API容器 → 3306端口 → MariaDB容器
Apache2容器详细配置
这个容器是对外暴露的入口,基本信息和代理配置如下:
- 外部可访问公网URL:
https://pct-datallama.purplestone-32662f92.australiaeast.azurecontainerapps.io/ - 核心代理配置(Apache配置文件片段):
TraceEnable off LogLevel trace5 Order deny,allow Allow from all ProxyPreserveHost On RequestHeader set X-Forwarded-Proto "http" RequestHeader set X-Forwarded-Port "8080" ProxyPass "/api" "http://datallama-api.internal.purplestone-32662f92.australiaeast.azurecontainerapps.io" ProxyPassReverse "/api" "http://datallama-api.internal.purplestone-32662f92.australiaeast.azurecontainerapps.io"
Spring Boot REST API容器详细配置
这个容器仅对内暴露,配置细节:
- ACA实例名:
datallama-api,ingress设为internal,内部域名:datallama-api.internal.purplestone-32662f92.australiaeast.azurecontainerapps.io - 应用核心配置:
- 明确监听8080端口
- 已禁用CORS
- POM中引入了
spring-boot-starter-actuator依赖 application.properties中的Actuator配置:management.endpoints.web.exposure.include=health management.endpoint.health.show-details=always
当前运行状态与问题
- 所有容器在ACA上均成功运行,没有任何健康探测错误
- 浏览器无法通过Apache2代理与REST API通信,用Postman测试代理URL时,返回以下错误:
Error 404 - This Container App is stopped or does not exist.
The Container App you have attempted to reach is currently stopped or does not exist. If you are the Container App administrator, please visit https://portal.azure.com/.
- 确认REST API容器是完全运行且健康的,但无论怎么调整代理配置,都无法成功转发请求
求助内容
有没有朋友成功在Azure Container Apps上部署过这种代理架构?或者能给我一些排查方向、配置修正的建议?
内容来源于stack exchange
相关产品推荐
相关产品推荐

