79263114

Date: 2024-12-08 18:40:45
Score: 1
Natty:
Report link

I think you need to use a reverse proxy such as Nginx for that. Personally, I prefer Traefik over Nginx as it can automatically handle tls certificates for you, so you do not need a seperate service for that. (I've also found Traefik to work better in Kubernetes environments, so you can apply your knowledge in both cases; not relevant if you're only using Docker however)

A reverse proxy allows you to decouple concern for things like path prefixes from your application and the deployment environment.

I recommend creating a routing rule for your prefix and then routing that request via a stripprefix middleware to your service. The middleware removes the path prefix from the HTTP request before it gets to your service, so it can correctly match the request path again.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: JohannFH