Sunday, August 23, 2009

Issue: Blog entry disappears

Final note for today:

Recently I had a strange problem with the Blog feature of liferay (which I heavily use for my intened web 2.0 features - especially letting "Guest" users write content)

"Blog posts" done by the users (with my own EasyBlog portlet) did not appear in the Blog portlets - but could be found with the admin portlets.
Changing the display time helped! Somehow the timezones of the three different timezone-settings
  1. operating system (ubuntu)
  2. virtual machine (set by the statical portal.propoerties at startup of liferay)
  3. liferay portal
got out of synch - maybe during some "daylight saving" change.

After some research on the topic I had to do a complete restart of my "Plesk" environment anyway - and the problem disappeared. :)

But next time when filling time-related parameters in the liferay API I would by carefull filling the Calendar objects with something from System - but rather search for an according (helper) API by liferay..
Eventually. :)

Apache (reverse) proxy for liferay

...by the way (as my last post just described some additional apache tuning) here my full vhost.conf file per each virtual liferay host.

Because there is one additional thing that might be interesting: I use the proxy (actually: Reverseproxy) from apache to map the port 80 to 9080 - and that in a virtual host environment.

So the full vhos.conf looks as follows:

LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so


RewriteEngine On
RewriteOptions Inherit
RewriteCond %{HTTP_HOST} !^www\.traumtube\.de [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.traumtube.de/$1 [L,R,NE]



Order deny,allow
Allow from all


ProxyPass / http://localhost:9080/
ProxyPassReverse / http://localhost:9080/
ProxyPreserveHost on

Virtual hosts with liferay - handling of "subdomain" www

As you might have noticed there were no major changes lately. But yesterday at least I did a lot of cleanups with the team. Most of them were content related - but one basic thing could be interesting for you as well: Fine tuning virtual hosting.

We are using the "virtual host" feature of liferay a lot.
(Control panel -> Server -> Portal instances)

Unfortunately you can just enter one single virtual host ID here. Usually the domain plus the www subdomain/prefix. (e.g. www.traumtube.de )
If a user now enters the URL without the subdomain (here: http://traumtube.de) he would not get to the intended page but to the first (default) virtual host. Reason is: Liferay doesn't match the HTTP_HOST as it doesn't match including the subdomain.

Finally I came up with a solution using Apaches mod_rewrite to achieve the desired flexibility:

RewriteEngine On
RewriteOptions Inherit
RewriteCond %{HTTP_HOST} !^www\.traumtube\.de [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://www.traumtube.de/$1 [L,R,NE]
Whoopie - that helped.

Hope that helps somebody with the same issues.
Cheers!