Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Sy Do
Error with use CDN
February 29, 2012 2:29 AM
Answer

Sy Do

Rank: New Member

Posts: 11

Join Date: December 21, 2010

Recent Posts

I'm using liferay portal 6.0.6 bundled tomcat 6.0.29 on ubuntu.
I use Apache server to host static content.
I configured CDN in portal-ext.properties file:

cdn.host.http=http://127.0.0.1/cdnliferay

and then I copied mytheme and html folder (from webapps/ROOT) to /var/www/cdnliferay folder of Apache server.
then I restarted tomcat server of liferay, after that There was a bug on that ( see more on attached file below)

Please go through that case and give me feedback as soon as posible !

Thank you so much!
Attachment

Attachments: cdn-error.jpg (21.3k)
Sy Do
RE: Error with use CDN
March 1, 2012 10:47 PM
Answer

Sy Do

Rank: New Member

Posts: 11

Join Date: December 21, 2010

Recent Posts

No one help me?
Amos Fong
RE: Error with use CDN
March 2, 2012 12:36 AM
Answer

Amos Fong

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1855

Join Date: October 7, 2008

Recent Posts

Hi Sy,

Essentially what the property does is for certain URLs (like images, css, etc.) Liferay will replace the host to use the CDN host. For example:
http://www.liferay.com/image/user_male_portrait?img_id=11144008&t=1330670928347

Will be changed to:
http://cdn.www.liferay.com/image/user_male_portrait?img_id=11144008&t=1330670928347

Is your CDN handling this correctly?
Sy Do
RE: Error with use CDN
March 2, 2012 1:23 AM
Answer

Sy Do

Rank: New Member

Posts: 11

Join Date: December 21, 2010

Recent Posts

Yes Amos!

this is my link http://127.0.0.1/cdnliferay/image/user_male_portrait?img_id=25302&t=1330679293205

I guess the wrong path to the YUI library of Liferay but I do not know how to fix
Sy Do
RE: Error with use CDN
March 6, 2012 1:20 AM
Answer

Sy Do

Rank: New Member

Posts: 11

Join Date: December 21, 2010

Recent Posts

emoticon
Olaf Kock
RE: Error with use CDN
March 6, 2012 11:09 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2717

Join Date: September 23, 2008

Recent Posts

Use Firebug or LiveHttpHeaders (both firefox plugins) or something similar to monitor which requests your browser sends out and if they return error status codes or similar. Then identify if the problematic URL is constructed correctly, how it would be handled correctly and where the actual problem is. Might be JS or CSS related, but you'll see it when you see that you get 404 or other errors on some URLs
Sy Do
RE: Error with use CDN
March 6, 2012 10:49 PM
Answer

Sy Do

Rank: New Member

Posts: 11

Join Date: December 21, 2010

Recent Posts

Thank for your reply!

after I test by using Firebug, i got some error messages as belows:
1. illegal XML character (barebone.jsp file)
2. Liferay.Portlet is undefined
3. Liferay.Util is undefined
4. AUI is not defined

How can I fix?
Bhuwan Gautam
RE: Error with use CDN
January 9, 2014 5:45 PM
Answer

Bhuwan Gautam

Rank: New Member

Posts: 22

Join Date: January 16, 2013

Recent Posts

I have placed
1javascript.fast.load=false
in portal-ext.properties and it works for me
Olaf Kock
RE: Error with use CDN
February 11, 2014 11:48 PM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 2717

Join Date: September 23, 2008

Recent Posts

This might be long cleared for you, but others might run into this and I found a few more things in your described configuration:

You say that you're using Apache to serve static content - however, this is (or can be) something completely different than a CDN: A CDN works like a reverse- & caching proxy: If it doesn't have some resources itself, it will forward the request to the underlying server, retrieve the resource, cache for future reference and deliver to the client.

I'm assuming that you have not configured such an integration with Apache - rather you deliver some content, like images etc. - through Apache. This is correct as well, but you shouldn't configure Liferay's CDN integration for this. What happens is this:

Liferay minifies CSS and Javascript. While this is dynamically generated, the content is supposed to be static. A CDN would handle it as a static resource, fetch once then cache. A regular Apache reverse(-noncaching-)proxy does not deliver this minified version, as it's not present in the directory that you copied into your /var/www/cdnliferay directory. Thus you get weird CSS effects and problems with Javascript not being properly initialized.

The solution: Don't configure cdn.host.http, rather use Apache mod_proxy or (my recommendation) mod_jk and specifically serve real static files (like /my-theme/images/ etc.) through Apache, the rest through Liferay. Another solution: Configure a proper CDN. The first solution is easy, the second is somewhat harder.