Nguyên nhân:
Khi dùng Cloudflare Access, lỗi "400 Bad Request – Request Header Or Cookie Too Large (nginx)" xảy ra khá thường vì cookie xác thực của Access rất lớn.
Bạn phải sửa file template:
/etc/nginx/uci.conf.template
Mở:
vi /etc/nginx/uci.conf.template
tìm dòng:
large_client_header_buffers 2 1k;
đổi thành:
client_header_buffer_size 16k;
large_client_header_buffers 4 64k;
Sau đó restart nginx
/etc/init.d/nginx restart
Kiểm tra lại
grep header /etc/nginx/uci.conf
nếu thấy:
client_header_buffer_size 16k;
large_client_header_buffers 4 64k;
là đã thành công.
Vì sao X-WRT làm vậy
Router dùng OpenWrt style config, nên:
UCI config
↓
uci.conf.template
↓
generate
↓
uci.conf
↓
nginx chạy
nên không sửa trực tiếp uci.conf.