bar-assistant icon indicating copy to clipboard operation
bar-assistant copied to clipboard

Potential FAQ Documentation for Path Forwarding/Reverse Proxy Issues

Open zarguell opened this issue 1 month ago • 1 comments

Describe the bug This is more of a documentation report, but it might be worth mentioning for a bring-your-own-reverse proxy setup the path forwarding implications for the API (and need to define prefix stripping). If you don't setup the pathing correctly, you'll get something like this going to /bar:

{"type":"api_error","message":"Resource not found."}

Nginx does path stripping by default, so the example configs work without mentioning this.

To Reproduce For example, when I set up Bar Assistant using Traefik, I originally tried setting up the Bar Assistant container with the following Traefik router (these are labels to enable Traefik on the docker containers that I have defined in an ansible playbook):

traefik.http.routers.barassistant.rule: "Host(`{{ barassistant_hostname }}.{{ my_domain }}`) && PathPrefix(`/bar`)"

But I needed to also add a middleware to strip the /bar from the path:

traefik.http.middlewares.barassistant-strip-path.stripPrefix.prefixes: "/bar"
traefik.http.routers.barassistant.middlewares: barassistant-strip-path

Effectively I was trying to hit /bar/docs instead of /docs and /bar/api/server/version instead of /api/server/version, and it wasn't really clear from the FAQ what was wrong because my API service was technically "reachable"

Versions:

  • Bar Assistant: v4
  • Salt Rim: v3

zarguell avatar Jan 06 '25 23:01 zarguell