RE: Liferay 7.2 + AWS Cloudfront - Issue

Pankaj Kathiriya, modified 5 Years ago. New Member Posts: 5 Join Date: 2/26/20 Recent Posts
I am trying to setup CDN with Liferay using AWS Cloudfront.However, after setting up CDN properties as per liferay documenation , Liferay generate CDN URLs for combo java-scripts.  Because combo javascripts are dynamic resources it does not get cached at CDN and gives 404 error for all such combo javascript resources.Has anybody successfully configured Liferay with AWS Cloud front? Please share your thoughts on error.
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I had a similar issue with 7.0 and ended up  using a custom jsp bag to replace top_head.jsp and change the way it behaves. We actually did a lot more, since we have multiple cdn services in use for different parts of the world, but I think, combo was in there. Somewhere in that file the urls for all kinds of includes are inserted in the page.
https://help.liferay.com/hc/en-us/articles/360017881172-JSP-Overrides-Using-Custom-JSP-Bag-
But I am not sure why you get 404 errors. Maybe you should look on cdn side if you could change the configuration. I am not familiar with AWS, but it should be possible to make it behave like a reverse proxy without caching.
Pankaj Kathiriya, modified 5 Years ago. New Member Posts: 5 Join Date: 2/26/20 Recent Posts
Thank you Christoph for your reply.
As per Liferay Documentation, https://docs.liferay.com/dxp/portal/7.2-latest/propertiesdoc/portal.properties.html#Content%20Delivery%20Network It mentions that if below property is used the liferay will work with AWS (and it will not load dynamic resources from CDN.)
    cdn.dynamic.resources.enabled=false
But in reality, its still tries to get dynamic resources from CDN.
Also, on your suggestion on overriding top_head.jsp; In liferay 7.2 these combo javascripts are getting added from Dynamic Include and I am not sure how to override them. I only see options to extend it here.
We are getting 404 because combo resources are not getting cached at CDN; I will look into further if reverse proxy like configuration is available with AWS Cloudfront. 
Thank you Again! 
thumbnail
Christoph Rabel, modified 5 Years ago. Liferay Legend Posts: 1555 Join Date: 9/24/09 Recent Posts
I checked the code and I see the change. Meh. I am quite sure that we will run into several issues with that code being in a DynamicInclude classe now. Meh.
It also seems that the code doesn't use the dynamic cdn url at all. getCDNDynamicResourcesHost is only used in jsps and jspf files. I'd say, that's a bug. If you are using DXP, you could open a ticket for it.
Pankaj Kathiriya, modified 5 Years ago. New Member Posts: 5 Join Date: 2/26/20 Recent Posts
Yes. Already have ticket for this.
Pankaj Kathiriya, modified 5 Years ago. New Member Posts: 5 Join Date: 2/26/20 Recent Posts
Is anyone out there who successfully integrated AWS Cloudfront CDN with Liferay DXP/7.2?