Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/common/router/router.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2032,9 +2032,9 @@ bool Filter::checkDropOverload(Upstream::ThreadLocalCluster& cluster,
if (config_.random_.bernoulli(cluster.dropOverload())) {
ENVOY_STREAM_LOG(debug, "The request is dropped by DROP_OVERLOAD", *callbacks_);
callbacks_->streamInfo().setResponseFlag(StreamInfo::ResponseFlag::DropOverLoad);
chargeUpstreamCode(Http::Code::ServiceUnavailable, nullptr, true);
chargeUpstreamCode(Http::Code::BadGateway, nullptr, true);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the RFC 503 definition of 503:

... indicates that the server is currently unable to handle the request due to a temporary overload or scheduled maintenance, which will likely be alleviated after some delay.

which seems like a better fit, no?

callbacks_->sendLocalReply(
Http::Code::ServiceUnavailable, "drop overload",
Http::Code::BadGateway, "drop overload",
[modify_headers, this](Http::ResponseHeaderMap& headers) {
if (!config_.suppress_envoy_headers_) {
headers.addReference(Http::Headers::get().EnvoyDropOverload,
Expand Down
2 changes: 1 addition & 1 deletion test/common/router/router_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -811,7 +811,7 @@ TEST_F(RouterTest, DropOverloadDropped) {
EXPECT_CALL(random_, random())
.WillRepeatedly(Return(0.2 * float(std::numeric_limits<uint64_t>::max())));

Http::TestResponseHeaderMapImpl response_headers{{":status", "503"},
Http::TestResponseHeaderMapImpl response_headers{{":status", "502"},
{"content-length", "13"},
{"content-type", "text/plain"},
{"x-envoy-drop-overload", "true"}};
Expand Down
2 changes: 1 addition & 1 deletion test/integration/eds_integration_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -930,7 +930,7 @@ TEST_P(EdsIntegrationTest, DataplaneTrafficAfterEdsUpdateOfInitializedCluster) {
// Test EDS cluster DROP_OVERLOAD configuration.
TEST_P(EdsIntegrationTest, DropOverloadTestForEdsClusterNoDrop) { dropOverloadTest(0, "200"); }

TEST_P(EdsIntegrationTest, DropOverloadTestForEdsClusterAllDrop) { dropOverloadTest(100, "503"); }
TEST_P(EdsIntegrationTest, DropOverloadTestForEdsClusterAllDrop) { dropOverloadTest(100, "502"); }

} // namespace
} // namespace Envoy