お知らせ
2023.12.5(Tue)
こんにちは。堀部です。
先日、Webアプリケーションを開発中にPOSTされるはずのデータが、サーバー側で受け取れていない事象が発生しました。大量データをPOSTした時にだけ発生していたので、何かあると思い調べてみると以下のログが出力されていました。
More than the maximum number of request parameters (GET plus POST) for a single request ([10,000]) were detected.
Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
要約すると、「リクエストパラメータの最大数を超えました。制限を超えたパラメータは無視されました。制限を変更するためにはConnectorのmaxParameterCount属性を設定してください。」という内容です。
Tomcatのserver.xmlの設定を変更します。
“maxParameterCount”のデフォルトは10,000なので、それよりも大きい値を設定します。また”maxParameterCount”と同じように、”maxPostSize”にもデフォルト2MBの制限があるため、同時に対応します。
<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" maxParameterCount="20000" maxPostSize="4194304" />