http convert to https

Michal Gažo, modified 5 Years ago. New Member Posts: 2 Join Date: 3/3/20 Recent Posts
Hi, I am new in Liferay. I have problem. All urls that contain http are changed to https. It makes me problem during generate .xls file. I have some item that contains atribute filled by url value http://somePage. I created HSSFWorkbook workbook, filled cell in sheet by http://somePage and after create .xls, the file is broken and contains https://somePage. When I am on localhost, url is not changed and contains http. When I am on my https:// page and I want generate .xls file, http is in file automaticaly changed to https. Even in database I have http, but in my forms on page I see https:// urls. Any advice how to turn off rewriting urls or any reason how it is possible? Thank you
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
In a default installation this should not happen.
a) Did you change the http connector in server.xml? If you set the scheme to https this will probably happen
b) Please check portal-ext.properties. Did you set web.server.protocol=https?
c) Do you have a reverse proxy or something?
Michal Gažo, modified 5 Years ago. New Member Posts: 2 Join Date: 3/3/20 Recent Posts
bingooooooooo ! It was in proxy emoticon
Thank you
thumbnail
Olaf Kock, modified 5 Years ago. Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts
Michal Gažo:

Hi, I am new in Liferay. I have problem. All urls that contain http are changed to https. It makes me problem during generate .xls file. I have some item that contains atribute filled by url value http://somePage. I created HSSFWorkbook workbook, filled cell in sheet by http://somePage and after create .xls, the file is broken and contains https://somePage. When I am on localhost, url is not changed and contains http. When I am on my https:// page and I want generate .xls file, http is in file automaticaly changed to https. Even in database I have http, but in my forms on page I see https:// urls. Any advice how to turn off rewriting urls or any reason how it is possible? Thank you

As Liferay doesn't generate anything, the generation process for your workbook is entirely custom code. It's up to you what you write in that file.
If you somehow obtain Liferay's base URL (e.g., I believe, through PortalUtil), you might end up with the https url - but it's still up to you to generate whatever you want into the file.
Typically, if you access the page through https, that's the URL and scheme that'll be used.
Notice that your system administration might set up HSTS, a flag that signals the browser that a webserver never again (for a certain period, e.g. 1 year) wants to be contacted in anything but https. If that's in the game for a given server, you won't have a chance to access that host name through http. And it might even come from the main domain, not from the subdomain that you're using.
Also, it's 2020, and I'd assume that all URLs are https anyway, and http is more or less only used to redirect the accidental and missed URL when a sysadmin forgot to configure HSTS. Make sure you answer on https, don't work on trying to make http work in 2020.