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
11 changes: 11 additions & 0 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,17 @@ http {
keepalive_timeout 65;
server_tokens off;
client_max_body_size 10m;
client_body_buffer_size 128k;
client_header_buffer_size 1k;
large_client_header_buffers 4 8k;

# Compression configuration for bandwidth and latency efficiency
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_min_length 256;
gzip_types application/javascript application/json application/xml text/css text/plain text/xml;

# Log the upstream destination and timing; no request bodies or credentials.
log_format edge '$remote_addr - $request_method $uri $status '
Expand Down
10 changes: 10 additions & 0 deletions tests/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,5 +96,15 @@ def test_compose_healthchecks_and_isolation(self):
self.assertIn('GF_USERS_ALLOW_SIGN_UP: "false"', compose)
self.assertIn('--nginx.scrape-uri=http://edge:8081/stub_status', compose)

def test_gzip_compression_and_buffer_tuning(self):
cfg = load('nginx/nginx.conf')
self.assertIn('gzip on;', cfg)
self.assertIn('gzip_vary on;', cfg)
self.assertIn('gzip_comp_level 5;', cfg)
self.assertIn('gzip_min_length 256;', cfg)
self.assertIn('application/json', cfg)
self.assertIn('client_body_buffer_size 128k;', cfg)
self.assertIn('large_client_header_buffers 4 8k;', cfg)

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