Shared storage not working between two instances of Caddy

Ok, so these are the scenarios that I’m talking about:

  1. Serve dashboard assets: https://staticful.net (user dashboard) -> [public Caddy] static assets (html, css, js, etc.)
  2. API request (e.g. by making an input and pressing a button in the dashboard): "link domain (e.g. prrtz.com) to a user's website" API request -> [public Caddy] reverse proxy to the node.js server (port 4000) -> [update internal Caddy's config via API] insert 'prrtz.com' into 'host' of the user's website config
  3. Serve user’s site assets: https://prrtz.com (user's website) -> [public Caddy] reverse proxy to internal Caddy -> [internal Caddy] match by domain and reverse proxy to the user-specific S3 bucket

At first I had a single Caddy server, but the any API requests that modified its config (2nd scenario) resulted in the context deadline exceeded error with the admin API shutting down. So I followed the advice in the Context Deadline Exceeded on Admin API Call post where you explain the problem and later say that another server is needed (although you also say that it’s possible to “bind the admin API to a non-localhost interface”, but I’m not sure if it applies in my case because I’m running everything on a single machine).

I know about the on-demand TLS feature, but I don’t know if it’s going to be helpful in my case because:

  1. In the second scenario where a user links a domain to their website I want to generate a free SSL certificate right away (that’s where Caddy helps a lot :pray:) and notify the user if there are any errors in case the Caddy API doesn’t return 200 or when issuing a certificate.
  2. I need to match multiple domains to a single S3 bucket (now that I think of it maybe it’s not a problem?)
  3. Soon I’m going to implement a feature where users will be able to add their own custom certificates instead of the default Let’s Encrypt or ZeroSSL ones (didn’t look into this yet, but I’m guessing I should be looking at JSON Config Structure - Caddy Documentation)

In my case that would be super useful because everything would just work :slightly_smiling_face: But I guess the question is how frequently are people hitting this problem? :man_shrugging:

Hopefully this clarifies my setup further (and if not, feel free to ask if anything is unclear). Also, I wanted to say thanks for making Caddy (especially making it configurable via an API and automatic HTTPS — those are life savers!) and providing great support for it!

1 Like