Skip to content

Commit e6318bf

Browse files
committed
Log an error cause for remaining 403 Forbidden responses
1 parent 600f505 commit e6318bf

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/middleware/block_traffic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ impl Handler for BlockTraffic {
4747
.iter()
4848
.any(|value| self.blocked_values.iter().any(|v| v == value));
4949
if has_blocked_value {
50+
super::log_request::add_custom_metadata(req, "cause", "blocked");
5051
let body = format!(
5152
"We are unable to process your request at this time. \
5253
This usually means that you are in violation of our crawler \

src/middleware/require_user_agent.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ impl Handler for RequireUserAgent {
2424
let has_user_agent = request_header(req, "User-Agent") != "";
2525
let is_download = req.path().ends_with("download");
2626
if !has_user_agent && !is_download {
27+
super::log_request::add_custom_metadata(req, "cause", "no user agent");
2728
let body = format!(
2829
include_str!("no_user_agent_message.txt"),
2930
request_header(req, "X-Request-Id"),

0 commit comments

Comments
 (0)