-
-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Add handler to just close a connection without responding #3871
Comments
I didn't know that! Worth a shot. Will check into it when I get a chance. (Or someone can beat me to it.) |
I like the same syntax that @mholt suggested at https://caddy.community/t/how-to-drop-connection/11167
|
@SvenDowideit The only problem with that is I assumed you didn't mind writing an HTTP response. It's weird to me that a directive named Maybe a special case like |
fair :) could promote ie just |
its probably just as weird as when you have no matchers, the status is still
|
That's normal, it means your web server is working. I'm OK with adding a new But maybe in the JSON it's OK if we fudge a little, where " |
ah, yup - that quandry i grok - syntax is forever :) |
Just curious... what is the actual need for this? Like why not just respond with a 400 status and then close? Why the need to be forceful/ungraceful about it? |
Yes, there's a need - we really don't want every spelling mistake, or
random string in a hostname to be considered a "this site exists, but you
may have gotten some detail wrong" - and there are enough crawlers out
there that use lack of response as the measure of "there is no site here,
don't bother trying later" to make it useful.
I presume the problem stems from our caddy files having all the routes
nested under wildcard section
*.domain.com domain {
route...
}
but that's being done _only_ because caddy needed it so each route got the
wildcard cert.
…On Thu, Jan 21, 2021 at 9:27 AM Matt Holt ***@***.***> wrote:
Just curious... what is the actual need for this? Like why not just
respond with a 400 status and then close? Why the need to be
forceful/ungraceful about it?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3871 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAG6TGRKAT5LRZYP2DZ4ODS25RERANCNFSM4TXMUNIA>
.
--
Sven.
|
I see... I'll be honest, I'm really struggling to make this work, at least, as far as I cannot get that line of output to go away with This is the best I've been able to do:
At least there was an "empty" reply, but I assume Maybe I just don't understand curl. If someone has more time right now and wants to write a simple Go client to inspect the behavior it in more detail, that could help us know if it's a curl thing or a Go thing.
Isn't that the case, though? Like, that is the whole point of 400 status. |
https://www.reddit.com/r/nginx/comments/jv9z7b/issues_with_ip_not_returning_444_but_instead/ this is an artifact of the fact caddy is actually listening, so it can find out what host the request is intended for - so is the right result. https://www.unixteacher.org/blog/blocking-access-by-user-agent-in-nginx/ |
Wouldn't ya know... turns out it was an unlikely bug in curl! Daniel Stenberg has kindly identified and fixed it already:
With that cleared up, I will push this feature soon. Seems that the |
v interesting! its fun to see what can happen when we ask questions - this has been a very long standing curl thing that too many of us assumed was "intended" - really excellent! |
… (#3983) * caddyhttp: Implement handler abort; new 'abort' directive (close #3871) * Move abort directive ordering; clean up redirects Seems logical for the end-all of handlers to go at the... end. The Connection header no longer needs to be set there, since Close is true, and the static_response handler now does that.
thank you :) that was the last thing keeping us from moving off nginx 👍 |
Nginx supports
return 444
to just close the connection without responding. This is often used in a default server so that Nginx doesn't answer any request with an invalidHost
header. It would be nice to have something similar in Caddy (Doesn't have to use a magic status code of course).P.S. In the Go
net/http
package, youpanic(http.ErrAbortHandler)
to abort with no response AFAIK (Needs to be checked). But anything callingrecover
along the way also needs to be aware of that.The text was updated successfully, but these errors were encountered: