Nginx-like auth request

Several people have asked for auth-request feature in Caddy ans I woukd need it too. There seems to be a plugin that would do the job, is there a way to get it listed and included on the download page?

We just released this functionality in v2.5.1, without the need for a plugin:

1 Like

Nice, its’ not fully there yet in the docs and with a JSON config it’s a bit less easy (bt much more configurable apparently). I could make it work with the following snippet:

{
  "apps": {
    "http": {
      "servers": {
        "default": {
          "listen": ["localhost:8080"],
          "routes": [
            {
              "handle": [
                {
                  "handler": "reverse_proxy",
                  "upstreams": [ { "dial": "127.0.0.1:8000"} ],
                  "handle_response": [
                    {
                      "match": { "status_code": [ 2 ] },
                      "routes": [
                        {
                          "handle": [
                            {
                              "handler": "static_response",
                              "body": "Hello World"
                            }
                          ]
                        }
                      ]
                    },
                    {
                      "routes": [
                        {
                          "handle": [
                            {
                              "handler": "copy_response_headers"
                            }
                          ]
                        },
                        {
                          "handle": [
                            {
                              "handler": "copy_response"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      }
    }
  }
}

Yeah, it was just released. We’re working on the docs:

JSON is always going to be harder to use, because it gives you full control. The Caddyfile is the “ease of use” layer for Caddy.

You can start from a Caddyfile, and run caddy adapt --pretty to convert it to JSON. That’ll give you a decent starting point.

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