Skip to content

Commit 3a248bd

Browse files
authored
adding x-robots-tag header to prevent crawling and linking (#74)
1 parent a133c99 commit 3a248bd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

crates/fastly/src/main.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ async fn route_request(settings: Settings, req: Request) -> Result<Response, Err
144144
};
145145

146146
// Convert any errors to HTTP error responses
147-
result.map_or_else(|e| Ok(to_error_response(e)), Ok)
147+
let mut response = result.unwrap_or_else(to_error_response);
148+
149+
// Add X-Robots-Tag header to prevent crawlers and indexers
150+
response.set_header("X-Robots-Tag", "noindex, nofollow");
151+
152+
Ok(response)
148153
}
149154

150155
fn is_partner_asset_path(path: &str) -> bool {

0 commit comments

Comments
 (0)