Reputation: 3530
I wish to send all urls with CR:LF characters in NGINX to error page. I try to find how to do it, but didn’t see any nginx support for it. How can I do it?
Upvotes: 3
Views: 2756
Reputation: 49692
The CR and LF characters will be encoded as %0D%0A
in the $request_uri
.
You could detect them by placing an if
block near the top of your server
block:
server {
...
if ( $request_uri ~* "%0A|%0D" ) { return 403; }
See this caution on the use of if
.
Upvotes: 5