我面临着数据表的长查询字符串问题,我猜有近 800 个参数
https://insurancedata.com/insurer/products/listing?draw=1&columns%5B0%5D%5Bdata%5D=checkbox&columns%5B0%5D%5Bname%5D=checkbox&columns%5B0%5D%5Bsearchable%5D=false&columns%5B0%5D%5Borderable%5D=false&columns%5B0%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B0%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B1%5D%5Bdata%5D=product_name&columns%5B1%5D%5Bname%5D=product_name&columns%5B1%5D%5Bsearchable%5D=true&columns%5B1%5D%5Borderable%5D=true&columns%5B1%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B1%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B2%5D%5Bdata%5D=product_code&columns%5B2%5D%5Bname%5D=product_code&columns%5B2%5D%5Bsearchable%5D=true&columns%5B2%5D%5Borderable%5D=true&columns%5B2%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B2%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B3%5D%5Bdata%5D=product_plan&columns%5B3%5D%5Bname%5D=product_plan&columns%5B3%5D%5Bsearchable%5D=true&columns%5B3%5D%5Borderable%5D=true&columns%5B3%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B3%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B4%5D%5Bdata%5D=rating_template&columns%5B4%5D%5Bname%5D=rating_template&columns%5B4%5D%5Bsearchable%5D=true&columns%5B4%5D%5Borderable%5D=false&columns%5B4%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B4%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B5%5D%5Bdata%5D=company_name&columns%5B5%5D%5Bname%5D=company_name&columns%5B5%5D%5Bsearchable%5D=true&columns%5B5%5D%5Borderable%5D=true&columns%5B5%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B5%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B6%5D%5Bdata%5D=subclass&columns%5B6%5D%5Bname%5D=subclass&columns%5B6%5D%5Bsearchable%5D=true&columns%5B6%5D%5Borderable%5D=true&columns%5B6%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B6%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B7%5D%5Bdata%5D=added_by&columns%5B7%5D%5Bname%5D=added_by&columns%5B7%5D%5Bsearchable%5D=true&columns%5B7%5D%5Borderable%5D=true&columns%5B7%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B7%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B8%5D%5Bdata%5D=status&columns%5B8%5D%5Bname%5D=status&columns%5B8%5D%5Bsearchable%5D=true&columns%5B8%5D%5Borderable%5D=true&columns%5B8%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B8%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B9%5D%5Bdata%5D=created_at&columns%5B9%5D%5Bname%5D=created_at&columns%5B9%5D%5Bsearchable%5D=true&columns%5B9%5D%5Borderable%5D=true&columns%5B9%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B9%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B10%5D%5Bdata%5D=updated_at&columns%5B10%5D%5Bname%5D=updated_at&columns%5B10%5D%5Bsearchable%5D=true&columns%5B10%5D%5Borderable%5D=true&columns%5B10%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B10%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B11%5D%5Bdata%5D=updated_by&columns%5B11%5D%5Bname%5D=updated_by&columns%5B11%5D%5Bsearchable%5D=true&columns%5B11%5D%5Borderable%5D=true&columns%5B11%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B11%5D%5Bsearch%5D%5Bregex%5D=false&columns%5B12%5D%5Bdata%5D=action&columns%5B12%5D%5Bname%5D=action&columns%5B12%5D%5Bsearchable%5D=true&columns%5B12%5D%5Borderable%5D=true&columns%5B12%5D%5Bsearch%5D%5Bvalue%5D=&columns%5B12%5D%5Bsearch%5D%5Bregex%5D=false&order%5B0%5D%5Bcolumn%5D=8&order%5B0%5D%5Bdir%5D=asc&start=0&length=10&search%5Bvalue%5D=&search%5Bregex%5D=false&class_id=2&_token=2Y3nvFtVS8btTtr8oLeGgJDi4dJ1Eq397XGi6CFy&_=1722267836255
我正在使用ubuntu。上面的网址显示 403 Forbidden 但如果我减少参数它工作正常
我的 php 设置是
upload_max_filesize = 200M
max_file_uploads = 200
max_execution_time = 240
max_input_time = 120
max_input_vars = 6000
memory_limit = 1G
post_max_size = 200M
有什么帮助吗?
403 Forbidden 错误表明服务器由于请求的长度而拒绝该请求。但在 PHP 中,查询字符串本身的长度没有具体限制。相反,限制通常是由网络服务器和浏览器施加的。
我不确定你有 Apache 还是 Nginx。那么,让我为您更新两者的最新情况。
如果您使用 Apache:
Apache 有一个名为 LimitRequestLine 的指令,用于设置 HTTP 请求行大小的限制。默认限制为 8190 字节(大约 8190 个字符)。要更改此限制,您可以在 Apache 配置文件中添加或修改 LimitRequestLine 指令:
LimitRequestLine 16384
重新启动 Apache 服务器
sudo systemctl restart apache2
如果您使用 Nginx:
打开 Nginx 配置文件,通常位于:
/etc/nginx/nginx.conf
添加或更新large_client_header_buffers指令以为您的标头分配更大的缓冲区:
http {
large_client_header_buffers 4 16k;
...
}
重启Nginx
sudo systemctl restart nginx
之后,您应该能够处理更长的查询字符串,而不会遇到 403 Forbidden 错误。