How to turn off: Liferay-generated URLS in HTML are coded in Hex Decimal

Steven Lorscheid, modified 11 Years ago. New Member Posts: 2 Join Date: 11/14/13 Recent Posts
Hi everyone,
Im using Liferay 6.2 EntrepriseEdition ServicePack 9.
I am confronted with the following problem:
URLs which are part of the returned HTML (for example references to styles ) are being coded by Liferay in Hex Decimal Code ( see http://character-code.com/ ).
Our Reverse proxy, who is responsible for URL-Rewriting searchs for something which is not Hex Decimal coded, and isn't able to find a match.
That causes him to think, that the URL is a relative one, and he tries to complete the relative URL by sticking his URL in front of the URL found in the HTML.

Finally the style cannot be loaded, because the URL is completly messed up.

Example:

1) URL which is used to call the Reverse Proxy Server: https://yyy.yy.yy/portal/[...]
2) Reverse Proxy Server replaces to https://zzz.zz.zz/portal/[...] and calls Liferay with that URL.
3) Liferay responds with an HTML-File which includes a reference to a Style-sheet: https://zzz.zz.zz/portal&#x2f[...];
4) Reverse Proxy Server wants to do URL-Rewriting and searchs in the HTML for pattern: "https://zzz.zz.zz/portal/" .
5) Reverse Proxy Server has no pattern match.
6) Reverse Proxy Server sticks "https://yyy.yy.yy/portal/" in front of https://zzz.zz.zz/portal&#x2f[...];
7) "https://yyy.yy.yy/portal/https://zzz.zz.zz/portal&#x2f[...]; is being returned.
8) URL is useless.

Question:
1) Is it possible to configure Liferay not to code URLS in Hex Decimal Code.?
2) Is it possible to configure Liferay to only return relativ URLs)

Thanks for help,
Steven
thumbnail
David H Nebinger, modified 11 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Steven Lorscheid:
1) Is it possible to configure Liferay not to code URLS in Hex Decimal Code.?


No.

2) Is it possible to configure Liferay to only return relativ URLs)


No.

Seriously, Liferay's URL generation has gone through many rounds of tweaking and changing over the years. The encoding is done for perhaps not so obvious reasons but they need to be done.

Have you asked in the forums for your reverse proxy server if it can be made smart enough to handle encoded urls?
Steven Lorscheid, modified 11 Years ago. New Member Posts: 2 Join Date: 11/14/13 Recent Posts
Hi David,

meanwhile we tried to contact the provider of our proxyserver. See what they answered us 2 days ago:

Extraweb only support percentage encoded urls that is of '%2f' type.
Urls encoded with '#', '&' and Decimal value are treated as normal strings. Thus when encountered with a 'href' tag it is considered a relative url and gets translated. The appliance is behaving correctly and as expected
.

So, is it possible to configure Liferay that it creates URLs, which are encoded in a different way, for example of '%2f' type, like mentioned above?

Regards,
Steven
thumbnail
David H Nebinger, modified 11 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
I think the hex encoding is done to encapsulate issues with i18n URLs. I'm not sure that it can be changed to handle %2f format as it can't support UTF-8.
have a same problem on LR6.2 GA4

any solution in this time?

we try to change HTTP to HTTPS from our TMG Firewall, but NOT all urls from liferay can be changed. only CSS +- JS form LR can not be rewrited. WHY? can not understand.

and not all Link Translation with Link mapping (from HEX-Form to NORMAL-string) work on Firewall...
https://zzz.zz.zz/portal/ ==> https://yyy.yy.yy/portal/


PLEASE HELP!!!!
thumbnail
Olaf Kock, modified 10 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
For moving from http to https you can make Liferay generate HTTPS links only. Just make tomcat (or whatever appserver you use) aware that the connection is coming in through HTTPS. This information will be checked by Liferay and Liferay will only generate https URLs for connections that come in through https. (AJP does this out of the box. For HTTP-proxying you might have to tweak tomcat's connectors and use one that you declare as secure in tomcat's configuration)

And you can tweak Liferay's settings more and just make Liferay unconditionally generate https URLs (search portal.properties for https, I don't have the reference at hand)
Olaf Kock:
For moving from http to https you can make Liferay generate HTTPS links only. Just make tomcat (or whatever appserver you use) aware that the connection is coming in through HTTPS. This information will be checked by Liferay and Liferay will only generate https URLs for connections that come in through https. (AJP does this out of the box. For HTTP-proxying you might have to tweak tomcat's connectors and use one that you declare as secure in tomcat's configuration)

And you can tweak Liferay's settings more and just make Liferay unconditionally generate https URLs (search portal.properties for https, I don't have the reference at hand)


Thanks Olaf!

we don't use HTTP on LifeRay-Server. This server work normal on port XY and our firewall do redirect from external URL https://site.com/home to internal http://local:XY/home

in this case, can I use your solution?
thumbnail
Olaf Kock, modified 10 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
You can test if tomcat is aware of the https nature of a connection by calling the PortletRequest's method isSecure or even on the original ServletRequest