Refactor Reorder-Menu-Items portlet to not POST reordered menu-items over query-string
Reorder-Menu-Items portlet is relying on query-string for sending reordered menu-items. This may cause error "HTTP code 414 Request-URI Too Large" from NGINX (on dotCMS Cloud servers) at the moment the reordered menu-items are saved and when the menu-items tree is quite big. Instead, the POST request should send the reordered menu-items over request-body.
Expected Behavior
Reorder-Menu-Items portlet should be able to save reordered menu-items when the menu-items tree is big. That can be achieved by having Reorder-Menu-Items portlet should sending the reordered menu-items tree over POST request body
Current Behavior
Reorder-Menu-Items portlet is not able to save a big tree of reordered menu-items. When NGINX is configured in front of dotCMS's tomcat and upon clicking on the "Save Changes" button on Reorder-Menu-Items portlet, the POST request fails with error "HTTP code 414 Request-URI Too Large" from NGINX. This is caused by the fact that the reordered menu-items tree is submitted over POST request query-string
Steps to Reproduce (for bugs)
The behavior with which Reorder-Menu-Items portlet sends reordered menu-items over query-string can be reproduced on latest dotCMS 4.0 demo site (https://demo.dotcms.com) with following steps:
- Log into https://demo.dotcms.com
- Go to Site Browser and click on folder "services"
- Double click on page "first-time-investors"
- Click on button "Lock for editing" at top-right side
- Click on "Reorder Menu" icon on menu at left-hand-side
- On Reorder-Menu-Items portlet, click on button "Save Changes"
- Inspect query-string generated for previous POST request and confirm that big menu-item trees would generate error "HTTP code 414 Request-URI Too Large" from NGINX
Context
The error documented on this issue (ie. "HTTP code 414 Request-URI Too Large" from NGINX) can only be reproduced over big menu-items trees. This has been the case for one of dotCMS's Cloud clients on dotCMS 3.7.1 version, which reported the issue that is currently tracked at https://my.dotcms.com/tickets/detail.dot?id=59edb35c-9b40-4186-a526-40b5417487ee. It has been analyzed that this requires refactorings on both Client-Side and Server-Side code and that is potentially affecting latest dotCMS versions (3.7.1 and 4.0)
Your Environment
- dotCMS version used: 3.7.1 and 4.0
- Browser Name and version: Firefox
- Operating System and version: Mac OSX
- Application Server and version: Tomcat
- Database and version: Postgres
@gabbydotCMS did we try my suggestion on the ticket?
@wezell not yet, I'll give you an update today
PR Core: https://github.com/dotCMS/core/pull/11669
PR Core release 4.1.0: https://github.com/dotCMS/core/pull/11694
Hotfix was successful on client's dEC environment https://my.dotcms.com/tickets/detail.dot?id=59edb35c-9b40-4186-a526-40b5417487ee
Thanks for the confirmation @gabbydotCMS