Web frontend has hardcoded rewrite url #8

Closed
opened 2025-03-16 18:05:49 +00:00 by itzaname · 11 comments
Owner

The web frontend is setup to proxy requests to localhost:8082 which is then baked into the build making it impossible to deploy this in Kubernetes as separate pods.

Requesting either:

  • Switch to middleware for the rewrite so it can accept an environment variable
  • Just directly call the api which will be mounted on /v1 under the same host on the Kubernetes ingress and don't do SSR
The web frontend is setup to proxy requests to localhost:8082 which is then baked into the build making it impossible to deploy this in Kubernetes as separate pods. Requesting either: - Switch to middleware for the rewrite so it can accept an environment variable - Just directly call the api which will be mounted on /v1 under the same host on the Kubernetes ingress and don't do SSR
itzaname added the
bug
label 2025-03-16 18:05:49 +00:00
Quaternions was assigned by itzaname 2025-03-16 18:05:49 +00:00
ic3w0lf22 was assigned by itzaname 2025-03-16 18:05:49 +00:00
interpreterK was assigned by Quaternions 2025-03-16 19:18:40 +00:00
Owner
  • SSR = server side rendering - I don't know how to configure this
  • Not sure what constitutes middleware, would it be a service available from Bun?

I hobbled together with my 3 active web dev brain cells

- SSR = server side rendering - I don't know how to configure this - Not sure what constitutes middleware, would it be a service available from Bun? I hobbled together #9 with my 3 active web dev brain cells
Owner

Wrote with the best of my ability

Wrote #10 with the best of my ability
Member

I wrote a prototype middleware that accepts an environment variable of API_HOST using nextjs

I wrote a prototype middleware that accepts an environment variable of `API_HOST` using nextjs
Author
Owner

New code is deployed at: https://maps.staging.strafes.net

Looks like the request to https://maps.staging.strafes.net/api/submissions?Page=1&Limit=100 is a 404 however.

New code is deployed at: https://maps.staging.strafes.net Looks like the request to https://maps.staging.strafes.net/api/submissions?Page=1&Limit=100 is a 404 however.
Owner

Thanks for making this project possible

Thanks for making this project possible
Owner

Why would it be 404, is there something wrong with the path? Middleware?

Why would it be 404, is there something wrong with the path? Middleware?
Author
Owner

I guess to be clear, the middleware change is non-functional and I posted the URL so that @interpreterK can see.

I guess to be clear, the middleware change is non-functional and I posted the URL so that @interpreterK can see.
Member

I mistakenly put the middleware script in the wrong directory, it shall work now?

I mistakenly put the middleware script in the wrong directory, it shall work now?
Owner

Is 59e5e529c6 resulting in two forward slashes? I looked at the request in firefox and it had this on it:
x-middleware-rewrite http://maptest-api:8080/v1//submissions?Page=1&Limit=100

Is 59e5e529c6e33de1266d2ad36e213bb3d185367d resulting in two forward slashes? I looked at the request in firefox and it had this on it: x-middleware-rewrite http://maptest-api:8080/v1//submissions?Page=1&Limit=100
Author
Owner

Not quite, I pushed an update to trim the /api prefix and now we're all set. Thanks!

Not quite, I pushed an update to trim the /api prefix and now we're all set. Thanks!
Author
Owner

@Quaternions nope the docs for API_HOST called for a trailing slash which was not appropriate. The code is fine.

@Quaternions nope the docs for API_HOST called for a trailing slash which was not appropriate. The code is fine.
Quaternions added this to the 1.0 Release milestone 2025-03-29 06:31:38 +00:00
Sign in to join this conversation.
No description provided.