So, what i would like to do is generate a redirect url that is embedded with custom, user specific json content. Here is some background:
- Im hosting a login portal using caddy-auth-port that has a list of my services that each redirect to a subdomain
- I need to have one of the redirect links have custom json content embedded in the redirect that is based on the currently logged in user (the content is for an access token to bypass login on the service)
- I dont know the best way to achieve this. Is this achievable from just a custom Caddyfile config or do I need to write a new module to take care of this?
Basically here is the sequence of events:
- User logs in
- User wants to goto service “ombi”
- Caddy references currently logged in user, sends an http request to ombi with that users associated plex token, and receives back the auth_token string from ombi
- Caddy then embeddeds the auth_token string from above into the request to ombi on the redirect
I think I can figure this out but just need some advice on which direction to head down. If i go the route of a http middleware module & write a ServeHttp function, how do I get if to only be used when the user clicks on the Ombi button from the portal page? Or do you have it filter out request that dont meet certain criteria (like request_destination = ombi.server.net or something)?
Any help is appreciated.