Message Boards

Redirect URL limited to 1400 characters when set using portlet 'param' tag?

Vladislav Kolev, modified 3 Years ago.

Redirect URL limited to 1400 characters when set using portlet 'param' tag?

New Member Posts: 4 Join Date: 9/7/20 Recent Posts
Hello everyone,

I recently ran into a problem when trying to set a redirect URL for the 'edit' view of the portlet. I have some additional filters added to the SearchContainer in the view page, which makes the URL larger. I am setting the 'redirect' variable to the current URL in the view-entity-actions.jsp and also in the view-entity.jsp as a portlet 'param' tag:
<portlet:renderurl var="editEntityRenderURL">
    <portlet:param name="redirect" value="${currentURL}" />
</portlet:renderurl>
The 'redirect' variable is then utilised in the edit-entity.jsp so that whenever the user clicks on a "Back", "Cancel" or "Submit" button, they will be redirected accordingly to the initial view page with their filter preferences kept. I've done a lot of scenario testing and turns out this works fine whenever the redirect URL does not exceed 1400 characters. Once it does, the redirect URL is basically not set whenever a transition is done from the 'view' to the 'edit' page.
I went through the documentation and I could not find such a limitation mentioned anywhere. Any clues why this happens? I am using Portlet Version 3.0, Liferay 7.1.3.

Any help would be highly appreciated!

Regards,
Vlad
Vladislav Kolev, modified 3 Years ago.

RE: Redirect URL limited to 1400 characters when set using portlet 'param'

New Member Posts: 4 Join Date: 9/7/20 Recent Posts
Hi again,
Any suggestions or questions in regards to this?  
thumbnail
Dominik Marks, modified 3 Years ago.

RE: Redirect URL limited to 1400 characters when set using portlet 'param'

Regular Member Posts: 149 Join Date: 8/29/12 Recent Posts
I assume this has something to do with the maximum URL length different browsers support. As far as I know common browsers have an URL limit of about 2000 characters.
Vladislav Kolev, modified 3 Years ago.

RE: Redirect URL limited to 1400 characters when set using portlet 'param'

New Member Posts: 4 Join Date: 9/7/20 Recent Posts
You are right about the 2000 limit, I am also aware of it. However that is not the issue here, since the overall URL that is generated is never above 2000 characters.
thumbnail
Ian Gosling, modified 3 Years ago.

RE: Redirect URL limited to 1400 characters when set using portlet 'param'

New Member Posts: 8 Join Date: 3/19/12 Recent Posts
We have run into the long URL problem before, in version 6.2. For us, it happened when the back URL in portlets started to accumulate redirects (i.e. navigation history) as a user clicked through links in search containers which led to pages with further search containers, etc. Liferay does some automatic shortening of URLs which get too long, if I remember correctly by trimming away the oldest levels of redirect. This can sometimes mean the whole redirect parameter gets trimmed away.
But we still got to a situation where this didn't do enough and we had to deliberately not use the redirect passed into a portlet request as the back URL but use something much shorter, such as the URL of a likely previous page, which would still give the user some sense of history.
HTH
Ian
Vladislav Kolev, modified 3 Years ago.

RE: Redirect URL limited to 1400 characters when set using portlet 'param'

New Member Posts: 4 Join Date: 9/7/20 Recent Posts
Yeah, I guess that makes sense when you implement multiple redirect levels. However, all I got is one "redirect level" and the redirect URL just stops being set once it goes over the 1400 character threshold... Anything below 1400 works absolutely fine.

Anyway, we switched back to the old way of redirecting pages by passing portlet parameters for each page. Thankfully, this still works.