Connect Caddy to redis

Hello There -

I’m new to caddy and have a pretty specific use-case, that seems really close, but not quite what I need in caddy:

  1. get some values from redis based on request
  2. Inject those values as a template into a php file

Is this possible? Any pointers where to get started? I have a some limited go experience, but not enough to know if this is a lost cause.


I don’t believe Caddy itself has any method to connect to Redis and inject the results into a templated PHP file (presumably you then want to actually process that PHP script).

Is PHP unable to connect to Redis?

Well, I actually want to connect to redis to lookup values based on the URL from the webserver and inject those either as templates or environment variables into my php script that bootstraps the app.

This is basically to connect to different database. I think i can accomplish this is nginx/openresty/lua, but was really liking some of what caddy had to offer.

Perhaps I don’t understand your setup. You can’t parse the URL within your PHP bootstrap script itself? What calls your bootstrap script, exactly? Surely you’d be able to take the request from Caddy, manipulate it in PHP to get the info you need, connect to Redis to get the corresponding values, then proceed as normal.

Is it something like this that Nginx HTTP Redis have you are looking for?

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