Fix websockets not reaching the container and remove v0/ prefix

This commit is contained in:
MartinBraquet
2025-10-09 16:58:20 +02:00
parent d6f6348ff1
commit 221cfa3528
3 changed files with 27 additions and 27 deletions

View File

@@ -185,29 +185,29 @@ resource "google_compute_url_map" "api_url_map" {
path_matcher {
name = "allpaths"
default_service = google_compute_backend_service.api_backend.self_link
# Priority 0: passthrough /v0/* requests
route_rules {
priority = 1
match_rules {
prefix_match = "/v0"
}
service = google_compute_backend_service.api_backend.self_link
}
# Priority 1: rewrite everything else to /v0
route_rules {
priority = 2
match_rules {
prefix_match = "/"
}
route_action {
url_rewrite {
path_prefix_rewrite = "/v0/"
}
}
service = google_compute_backend_service.api_backend.self_link
}
#
# # Priority 0: passthrough /v0/* requests
# route_rules {
# priority = 1
# match_rules {
# prefix_match = "/v0"
# }
# service = google_compute_backend_service.api_backend.self_link
# }
#
# # Priority 1: rewrite everything else to /v0
# route_rules {
# priority = 2
# match_rules {
# prefix_match = "/"
# }
# route_action {
# url_rewrite { # This may break websockets (the Upgrade and Connection headers must pass through untouched).
# path_prefix_rewrite = "/v0/"
# }
# }
# service = google_compute_backend_service.api_backend.self_link
# }
}
}

View File

@@ -20,10 +20,10 @@ export class APIError extends Error {
}
}
const prefix = 'v0'
const prefix = ''
export function pathWithPrefix(path: string) {
return `/${prefix}${path}`
return `${prefix}${path}`
}
export function getWebsocketUrl() {
@@ -33,5 +33,5 @@ export function getWebsocketUrl() {
export function getApiUrl(path: string) {
const protocol = IS_LOCAL ? 'http' : 'https'
return `${protocol}://${BACKEND_DOMAIN}/${prefix}/${path}`
return `${protocol}://${BACKEND_DOMAIN}${prefix}/${path}`
}

View File

@@ -5,7 +5,7 @@ cd "$(dirname "$0")"/..
source .env
export url=http://localhost:8088/v0
export url=http://localhost:8088
#export url=https://api.compassmeet.com
export endpoint=/internal/send-search-notifications