在 NGINX 中避免使用 CR:LF 字符

MID*_*E11 3 nginx

我希望将 NGINX 中所有带有 CR:LF 字符的 url 发送到错误页面。我试图找到如何做到这一点,但没有看到\xe2\x80\x99t 看到任何 nginx 支持。我该怎么做?

\n

Ric*_*ith 5

CR 和 LF 字符将%0D%0A按照$request_uri.

if您可以通过在块顶部附近放置一个块来检测它们server

server {
    ...
    if ( $request_uri ~* "%0A|%0D" ) { return 403; }
Run Code Online (Sandbox Code Playgroud)

请参阅有关使用的注意事项if