angular 5 的静态脚本文件停止使用带有 docker swarm 的 traefik 代理

Static script files for angular 5 stops working with traefik proxy with docker swarm

我有一个 nginx 容器,它将在所有域的端口 80 上为 angular 应用程序提供服务。 当我在 docker swarm 中启动容器作为服务并将其绑定到端口 80 时。应用程序运行良好。

但我尝试使用 traefik 反向代理,之后只有 HTML 正常工作,所有脚本都没有加载错误

Refused to execute script from '' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. Refused to execute script from 'http://app.local/runtime.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. app.local/:1 Refused to execute script from 'http://app.local/polyfills.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. app.local/:1 Refused to execute script from 'http://app.local/styles.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. app.local/:1 Refused to execute script from 'http://app.local/vendor.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled. app.local/:1 Refused to execute script from 'http://app.local/main.js' because its MIME type ('text/plain') is not executable, and strict MIME type checking is enabled.

对于 traefik,我遵循了 https://jmkhael.io/traefik-as-a-dynamic-reverse-proxy-for-docker-swarm/

中的步骤
docker network create --driver=overlay traefik-net 


docker service create \
--name traefik \
--constraint 'node.role==manager' \
--publish 80:80 \
--publish 8080:8080 \
--mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock \
--network traefik-net \ traefik \
--docker \
--docker.swarmmode \
--docker.domain=jmkhael.io \
--docker.watch \
--logLevel=DEBUG \
--web 

以及应用程序服务

docker service create \
--name web \
--label 'traefik.port=80' \
--label traefik.frontend.rule="app.local; Path: /" \
--network traefik-net \ app

这是正确的方法吗?或者我是否缺少任何其他配置。 非常感谢。

删除

后应用程序开始运行

Path: /

Web 容器标签中的一部分。