The original post: /r/nginx by /u/AleixoLucas on 2024-09-06 14:28:31.
Hello everyone, could you help me with this? I’m trying to block manual connections/Raw HTTP Request in my nginx, I’m doing a test like in the image, but it still returns 400, I wanted it to be 444; Do you know any other way to block this type of connection?
My docker compose:
name: nginx-httpe2ban
services:
nginx:
container_name: nginx-test
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf:ro
image: nginx:latest
ports:
- 8080:80
environment:
- NGINX_PORT=80
My nginx.conf
server {
listen 80;
server_name _;
if ($host = "") {
return 444;
}
location /401 {
return 401;
}
}
Raw command
echo -ne “GET / HTTP/1.1\r\n\r\n” | nc 127.0.0.1 8080
You must log in or register to comment.