Added CORS headers to gitea to allow API access

This commit is contained in:
Luke Else 2025-02-09 16:33:42 +00:00
parent 53be537298
commit ad052fea2d
2 changed files with 13 additions and 7 deletions

View File

@ -32,6 +32,11 @@ services:
## Expose Gitea Through Trefik ##
- "traefik.enable=true" # <== Enable traefik to proxy this container
- "traefik.http.middlewares.cors-gitea.headers.accesscontrolallowmethods=*"
- "traefik.http.middlewares.cors-gitea.headers.accesscontrolalloworiginlist=*"
- "traefik.http.middlewares.cors-gitea.headers.addvaryheader=true"
- "traefik.http.middlewares.cors-gitea.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.redirect-web-secure.redirectscheme.scheme=https"
- "traefik.http.routers.gitea-insecure.middlewares=redirect-web-secure"
- "traefik.http.routers.gitea-insecure.rule=Host(`git.luke-else.co.uk`)"
@ -41,6 +46,7 @@ services:
- "traefik.http.routers.gitea.rule=Host(`git.luke-else.co.uk`)"
- "traefik.http.routers.gitea.entrypoints=websecure"
- "traefik.http.routers.gitea.tls.certresolver=myresolver"
- "traefik.http.routers.gitea.middlewares=cors-gitea"
restart: unless-stopped
networks:

View File

@ -19,12 +19,12 @@ services:
- "traefik.enable=true" # <== Enable traefik to proxy this container
# Enable CORS headers
- "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=*"
- "traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist=https://luke-else.co.uk"
- "traefik.http.middlewares.cors.headers.accesscontrolallowcredentials=true"
- "traefik.http.middlewares.cors.headers.accesscontrolallowheaders=Content-Type,Authorization"
- "traefik.http.middlewares.cors.headers.addvaryheader=true"
- "traefik.http.middlewares.cors.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.cors-tracking.headers.accesscontrolallowmethods=*"
- "traefik.http.middlewares.cors-tracking.headers.accesscontrolalloworiginlist=https://luke-else.co.uk"
- "traefik.http.middlewares.cors-tracking.headers.accesscontrolallowcredentials=true"
- "traefik.http.middlewares.cors-tracking.headers.accesscontrolallowheaders=Content-Type,Authorization"
- "traefik.http.middlewares.cors-tracking.headers.addvaryheader=true"
- "traefik.http.middlewares.cors-tracking.headers.accesscontrolmaxage=100"
- "traefik.http.middlewares.redirect-web-secure.redirectscheme.scheme=https"
- "traefik.http.routers.ackee-insecure.middlewares=redirect-web-secure"
@ -34,7 +34,7 @@ services:
- "traefik.http.routers.ackee.rule=Host(`tracking.luke-else.co.uk`)"
- "traefik.http.routers.ackee.entrypoints=websecure"
- "traefik.http.routers.ackee.tls.certresolver=myresolver"
- "traefik.http.routers.ackee.middlewares=cors"
- "traefik.http.routers.ackee.middlewares=cors-tracking"
depends_on:
- mongo
restart: unless-stopped