From c7ae97c057fb323c6cfe1ec64b4fd32e4abee275 Mon Sep 17 00:00:00 2001 From: cdricms <36056008+cdricms@users.noreply.github.com> Date: Tue, 11 Feb 2025 11:22:43 +0100 Subject: [PATCH] Route to /api/ when on prod --- backend/utils/get_url.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/utils/get_url.go b/backend/utils/get_url.go index d6bf868..b01948d 100644 --- a/backend/utils/get_url.go +++ b/backend/utils/get_url.go @@ -3,6 +3,7 @@ package utils import ( "fmt" "net/http" + "os" ) func GetURL(r *http.Request) string { @@ -17,7 +18,10 @@ func GetURL(r *http.Request) string { // Get the full request URI (path + query string) fullPath := r.URL.Path + if os.Getenv("ENVIRONMENT") != "DEVELOPMENT" { + fullPath += "/api/" + } + // Build the full request URL return fmt.Sprintf("%s://%s%s", scheme, host, fullPath) } -