我在我的 Ubuntu 服务器上使用 Traefik。Cors 在一个网站上运行良好,但当我尝试将它用于两个网站时,它们似乎发生了冲突。正确的语法是什么?
这是我的 docker-compose 文件中的内容:
服务 1:
- "traefik.http.routers.service-one.middlewares=cors"
- "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=GET,OPTIONS,PUT"
- "traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist=https://site1.com,https://site2.com,https://site2.com"
- "traefik.http.middlewares.cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.cors.headers.addvaryheader=true"
服务 2:
- "traefik.http.routers.service-two.middlewares=cors"
- "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=GET,OPTIONS,PUT"
- "traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist=https://site1.com,https://site2.com,https://site2.com"
- "traefik.http.middlewares.cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.cors.headers.addvaryheader=true"