Can you get a value from another server and set the returned value in a variable?

Problem -

I have small docker container that returns a parameter value based on a path in the uri. It’s running on the same server as the Caddy server (also running in Docker)

I’m looking to take that value and use inside a hander to validate.

For example - I’d like to take the request, pull out a customer ID from the header,
(easy), create a url out of it like: http://0.0.0.0:8500/get_permission/

Get the value returned by that call and pass it to a reverse proxy. All with in the Caddy config.

You’ll probably want to look into intercepting responses from an upstream:

This is how forward auth works, making an initial reverse proxy request to the auth provider and taking the response into account before proceeding with the main reverse proxy for the client.

1 Like

As @Whitestrake implied, take a look at the forward_auth directive:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.