Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ http {
sendfile on;
tcp_nopush on;
keepalive_timeout 65;
client_body_timeout 15s;
client_header_timeout 15s;
send_timeout 15s;
reset_timedout_connection on;
server_tokens off;
client_max_body_size 10m;
client_body_buffer_size 128k;
Expand Down
1 change: 1 addition & 0 deletions nginx/snippets/proxy.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
proxy_http_version 1.1;
proxy_ssl_server_name on;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
Expand Down
10 changes: 10 additions & 0 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,5 +142,15 @@ def test_trace_id_propagation_in_demo_app(self):
self.assertIn('data["requestId"] = req_id', source)
self.assertIn('"X-Request-ID": req_id', source)

def test_slowloris_timeouts_and_socket_resets(self):
cfg = load('nginx/nginx.conf')
self.assertIn('client_body_timeout 15s;', cfg)
self.assertIn('client_header_timeout 15s;', cfg)
self.assertIn('send_timeout 15s;', cfg)
self.assertIn('reset_timedout_connection on;', cfg)

proxy = load('nginx/snippets/proxy.conf')
self.assertIn('proxy_ssl_server_name on;', proxy)

if __name__ == '__main__':
unittest.main()
Loading