Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement configurable ReadTimeout, WriteTimeout, and IdleTimeout #1311

Closed
mholt opened this issue Dec 28, 2016 · 2 comments · Fixed by #1368
Closed

Implement configurable ReadTimeout, WriteTimeout, and IdleTimeout #1311

mholt opened this issue Dec 28, 2016 · 2 comments · Fixed by #1368
Assignees
Labels
feature ⚙️ New feature or request

Comments

@mholt
Copy link
Member

mholt commented Dec 28, 2016

Some recent events have reminded me that we should finally implement this TODO in Caddy: a way to set WriteTimeout, ReadTimeout, and (coming in Go 1.8) IdleTimeout.

Required reading:

I figure this will be either one or three new directives for the Caddyfile.

Since these timeouts can't be set on a per-request basis, we have to reduce any repeated invocations of these directives across sites on a listener to a single value -- probably the lowest value among them. This is not too bad. We can print a warning if that's the case.

While we're at it, we should also make the max header size configurable too.

@mholt mholt added the feature ⚙️ New feature or request label Dec 28, 2016
@cuu508
Copy link

cuu508 commented Jan 21, 2017

Do these timeouts have some default values currently? Or are they 0 (never times out)?
A more general question, do you think it would currently be OK to expose Caddy directly to internet, without a reverse proxy in front of it?

I recently noticed a problem on a server running Caddy 0.8.3. By looking at netstat output it looked like the server is slowly accumulating open, established and very old (hours, days) connections, attributed to the caddy process. Could this have been an issue with timeouts?

@mholt
Copy link
Member Author

mholt commented Jan 21, 2017

They don't time out currently.

do you think it would currently be OK to expose Caddy directly to internet, without a reverse proxy in front of it?

About as safe as it would be to expose any other web server to the Internet. Depends on your threat model. Before jumping to conclusions, always create a threat model first. If you're worried about DoS attacks, you should probably put something like Cloudflare in front of your site.

I recently noticed a problem on a server running Caddy 0.8.3. ... Could this have been an issue with timeouts?

That's an issue with server administration. You need to upgrade. That version is over a year old.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature ⚙️ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants