Skip to content

Commit

Permalink
fix api routing
Browse files Browse the repository at this point in the history
do not alter routes in the app itself
Use traefik to strip the api prefix from the requests redirected
to the api
  • Loading branch information
leej3 committed Nov 13, 2024
1 parent 09d6d32 commit 7aad9f5
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy-opentofu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
type: choice
options:
- staging
- production
- production
pull_request:
branches:
- main
Expand Down
1 change: 0 additions & 1 deletion web/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ async def get_invocation_by_id(id: ObjectId):
app=app,
host="0.0.0.0",
port=80,
root_path="/api",
loop=loop,
log_config=LOGGING_CONFIG,
)
Expand Down
2 changes: 2 additions & 0 deletions web/deploy/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ services:
- traefik.enable=true
- traefik.docker.network=osm_traefik-public
- traefik.http.routers.osm_web_api.rule=Host(`${DEPLOYMENT_URI}`) && PathPrefix(`/api`)
- "traefik.http.middlewares.strip-api-prefix.stripprefix.prefixes=/api"
- "traefik.http.routers.osm_web_api.middlewares=strip-api-prefix@docker"
- "traefik.http.routers.osm_web_api.entrypoints=web,websecure"
- "traefik.http.routers.osm_web_api.service=osm_web_api"
- traefik.http.services.osm_web_api.loadbalancer.server.port=80
Expand Down

0 comments on commit 7aad9f5

Please sign in to comment.