Fórum

CSS and Theme not loading over https

Parnali Banerjee, modificado 8 Anos atrás.

CSS and Theme not loading over https

New Member Postagens: 2 Data de Entrada: 13/06/15 Postagens Recentes
I have developed and deployed a portlet in liferay 6.2 ga4. The tomcat port is changed to 9080 instead of default 8080. When I am trying to access the portlet over http all the css and themes are loading properly. However, I need to run over https so I commented out the 9080 connector port in server.xml,opened the 8443 one, created self signed certificate using keytool, pointed out the keystore path in the 8443 connector port section and restarted tomcat. Now, when I am trying to access the portlet over https, the portlet is visible but in a distorted manner. The css and the theme fails to load and the browser log is showing a mixed content error. Why this is happening? Am I missing out some configuration?

Any help will be truly appreciated!!
thumbnail
Jack Bakker, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

Liferay Master Postagens: 978 Data de Entrada: 03/01/10 Postagens Recentes
Parnali Banerjee:
I have developed and deployed a portlet in liferay 6.2 ga4. The tomcat port is changed to 9080 instead of default 8080. When I am trying to access the portlet over http all the css and themes are loading properly. However, I need to run over https so I commented out the 9080 connector port in server.xml,opened the 8443 one, created self signed certificate using keytool, pointed out the keystore path in the 8443 connector port section and restarted tomcat. Now, when I am trying to access the portlet over https, the portlet is visible but in a distorted manner. The css and the theme fails to load and the browser log is showing a mixed content error. Why this is happening? Am I missing out some configuration?

Any help will be truly appreciated!!


most clients (like perhaps a browser) ask (request) for http at port 80, where the client requests https at port 443

I put Apache in front of Liferay/Tomcat where Apache listens for requests on port 80 and 443, and in turn hands off connections (using the mod_jk connector) to a Liferay tomcat most commonly listening on port 8009

I think you need to align your configs to deliver on port 80 for http and 443 for https

--
as a side note, these days as a general rule with several advantages (including Google supposedly ranking https higher), I redirect, in apache, any requests to http(80) to https(443) and put in portal-ext.properties the following

web.server.protocol=https
company.security.auth.requires.https=true
thumbnail
Olaf Kock, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
  • First of all: Check if you're generating the expected URLs, but they don't give the required data.
  • IF you have the correct URLs (e.g. https://yourserver:8443/your-theme/some/resource) make sure that your server actually delivers the resource. If you are using Apache in front of Tomcat, this is commonly missed)
  • IF you aren't getting the expected URLs (e.g. https://yourserver/some-resource - missing the port number) check Liferay's portal.properties for port configurations (e.g. give Liferay a hint that your https port is nonstandard)
  • IF you get http URLs, you might need to configure tomcat or apache so that Liferay knows that your request is actually transmitted through https. This also commonly happens when you have an Apache in front of Tomcat.
Parnali Banerjee, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

New Member Postagens: 2 Data de Entrada: 13/06/15 Postagens Recentes
I am getting the expected url but the page is not displayed with proper css and theme. Do I need to configure something in the properties file. I am attaching the portel-developer.properties as well as portal-ext.properties file. Please guide me how to solve this. The tomcat is running under the subcontext of Apache.
thumbnail
Olaf Kock, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

Liferay Legend Postagens: 6403 Data de Entrada: 23/09/08 Postagens Recentes
If you look at a page that gets generated on https: Where do the CSS files get loaded from? (view source, then search for "css", validate the URL).
If the URL for the CSS file looks legit (e.g. is loaded through the expected https protocol): Copy and paste it into your browser's URL and check what comes back. Post both results here unless this already solved your problem.

Also: If your Apache forwards all requests to /portal to your tomcat, it will also need to forward all the requests to /my-theme to your tomcat in order for the css files and images to be properly delivered to the browser.
Sharad Sinha, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

Junior Member Postagens: 44 Data de Entrada: 08/03/13 Postagens Recentes
Hi,

When you configure apache httpd, use AJP port instead of HTTP port. You can find this port in your server.xml file of tomcat, if it is disabled, you can enable this.
e.g

if your AJP port is 8009 then in your apache httpd configuration file, your URL will be:

ajp://<HOST>:<PORT>/

I hope this will be useful
thumbnail
Jack Bakker, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

Liferay Master Postagens: 978 Data de Entrada: 03/01/10 Postagens Recentes
Olaf is offering the best troubleshooting right now given we don't don't know the full context.

That said though, again I recommend putting Apache in front of Liferay/Tomcat, where Apache services the http and https, and hands off requests to Liferay in the background using mod_jk.
thumbnail
Juan Gonzalez, modificado 8 Anos atrás.

RE: CSS and Theme not loading over https

Liferay Legend Postagens: 3089 Data de Entrada: 28/10/08 Postagens Recentes
Hi Parnali,

did you set:

web.server.https.port


too in your portal-ext.properties? As what I see, you didn't...