Adding buffer_requests to Caddyfile for reverse proxy

Thank you very much for any help you can offer! Here is the information below:

1. Caddy version (caddy version): v2.1.1

2. How I run Caddy:

Caddy automatically starts with system, since I installed via the official caddy repository through the Debian package manager.

a. System environment:

OS: Debian Buster 10

b. Command:

caddy reload

c. Service/unit/compose file:


d. My complete Caddyfile or JSON config:

# Add gzip compression to requests
(webconf) {
  encode gzip

# Site imports
import /home/nonroot/caddy/sites/*.caddy

Here is the content of the flaskapp.caddy file that is being imported: {
  reverse_proxy {
    # buffer_requests true 
  import webconf

3. The problem I’m having:

I’m trying to see if I can set buffer_requests to true through a Caddyfile. I can see that it’s possible to do it in the json configuration, but wanted to see here if there is anything I can do to get it to work in a Caddyfile?

4. Error messages and/or full log output:

If I uncomment out the buffer_requests true line, I get an error:
Error during parsing: unrecognized subdirective buffer_requests

5. What I already tried:

I went through the Caddy documentation for Caddyfile directives and did not see specific examples of this setting being used (only in the Json documention). I wasn’t sure if subdirectives should generally work inside curly braces or only certain ones.

6. Links to relevant resources:

The options for the reverse_proxy directive are documented here:

I think you’re probably looking for the flush_interval option instead.

I don’t think buffer_requests is available via the Caddyfile currently. It’s not recommended to use that option for performance reasons, as mentioned in the JSON docs.

Oh excellent, thank you for the response. It looks like flush_interval would work for this.

The reason I was interested in this was because I was using gunicorn and according to this post, the buffer_requests option was added specifically because of gunicorn. I’ll look into the docs a bit more and see if I can get what I need with flush_interval. I appreciate the response!

I wrote a quick PR to add that option to the Caddyfile:

Thanks, I really appreciate that and look forward to seeing it in a future release. In the meantime, I’ll explore the flush_interval directive.

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