RE: Lieray DXP 7.4 + Azure Cloud Front CDN

Elena Muñoz, modified 6 Months ago.

Lieray DXP 7.4 + Azure Cloud Front CDN

New Member Posts: 5 Join Date: 12/10/19 Recent Posts

Hi,

We currently have Liferay integrated with CDN and CSS, JS are being served from the CDN without issues. However my main conern are the files (PDF files from Document Library) I would like that those files were downloaded or loaded (while preview) from the CDN but is not happening; they always are downloaded from the Portal itself  (not CDN).

Please, any idea would be great, as i do not know how to change that behaviour. Basically: How do i set Liferay to load PDF files from the CDN.

Thanks in advance.

 

 

thumbnail
Olaf Kock, modified 6 Months ago.

RE: Lieray DXP 7.4 + Azure Cloud Front CDN

Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

Are they world-readable, or under access control? If they're not world-readable, this would prevent CDN use on them.

Elena Muñoz, modified 6 Months ago.

RE: Lieray DXP 7.4 + Azure Cloud Front CDN

New Member Posts: 5 Join Date: 12/10/19 Recent Posts

Hi Olaf,

Yes, they are. But it does not work.... i works (cach) for everything  but for PDF files from the document library.  When you download or preview a document this will always come from the portal itself not the CDN....

 

Any clue?

Regards,

 

 

thumbnail
Olaf Kock, modified 6 Months ago.

RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN

Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent Posts

Try these:

Access the PDF in question, bypassing the CDN (e.g. directly from the Liferay server) and note the HTTP-Headers that are delivered. These might block the CDN from caching.

Check if the CDN has some explicit configuration options that might black- or white-list some of the URLs for either documents or previews. Especially in larger environments, we sometimes see one admin configuring "as far as they can observe", only for another one (e.g. you) to later figure out that this was not enough.

Also, check the configured host names: If the request for the preview bypasses the CDN because it uses a host name that is not handled by the CDN, you can either change that on the Liferay side, or also map that host name in the CDN. (Variations with and without "www" are good candidates, now that browsers effectively hide the actual host name they're requesting)

Elena Muñoz, modified 6 Months ago.

RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN

New Member Posts: 5 Join Date: 12/10/19 Recent Posts

Hi, 

Thanks for the ideas.. here some pics:

Here headers from local lfieray portal:

Headers_Local

Here from the CDN:

Headers_CDN

And yes, they are world readable.

Thanks a lot for any clue...

Michael.

thumbnail
Sergio Sanchez, modified 6 Months ago.

RE: Lieray DXP 7.4 + Azure Cloud Front CDN

Regular Member Posts: 149 Join Date: 7/6/11 Recent Posts

You can include the Cache-Control headers for requests to /documents

You can do it though Instance Settings > Documents and Media > Cache Control

Elena Muñoz, modified 6 Months ago.

RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN

New Member Posts: 5 Join Date: 12/10/19 Recent Posts

Hi Sergio

Currently, the pdfs are already being cached on the CDN... but when you hit download or preview the files,... they are always downloaded from the Liferay portal and not from the CDN. Please ask if anything else needs to be done for Liferay to send it to the CDN and not “provide it itself”.

Regards,

thumbnail
Sergio Sanchez, modified 6 Months ago.

RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN

Regular Member Posts: 149 Join Date: 7/6/11 Recent Posts

Hello Elena, did you apply the configuration I suggested?

Any changes?

Elena Muñoz, modified 6 Months ago.

RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN

New Member Posts: 5 Join Date: 12/10/19 Recent Posts

Hi Sergio,

We apply the indicated configuration but the operation remains the same.

​​​​​​​

Any suggestions?

thumbnail
Sergio Sanchez, modified 6 Months ago.

RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN

Regular Member Posts: 149 Join Date: 7/6/11 Recent Posts

I set up the configuration to be public and TTL of 3600 seconds and when I request the file with its URL, I can see the expected headers.

Inspecting with Developer Tools, I can see

cache-control:public, max-age=3600
 

Community
Company
Feedback