Lieray DXP 7.4 + Azure Cloud Front CDN

1年前 に Jamie Sammons によって更新されました。 New Member 投稿: 5 参加年月日: 19/12/10 最新の投稿

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
1年前 に Olaf Kock によって更新されました。 Liferay Legend 投稿: 6441 参加年月日: 08/09/23 最新の投稿

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

1年前 に Olaf Kock によって更新されました。 New Member 投稿: 5 参加年月日: 19/12/10 最新の投稿

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
1年前 に Olaf Kock によって更新されました。 Liferay Legend 投稿: 6441 参加年月日: 08/09/23 最新の投稿

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)

1年前 に Jamie Sammons によって更新されました。 New Member 投稿: 5 参加年月日: 19/12/10 最新の投稿

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
1年前 に Sergio Sanchez によって更新されました。 Regular Member 投稿: 149 参加年月日: 11/07/06 最新の投稿

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

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

1年前 に Olaf Kock によって更新されました。 New Member 投稿: 5 参加年月日: 19/12/10 最新の投稿

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
1年前 に Sergio Sanchez によって更新されました。 Regular Member 投稿: 149 参加年月日: 11/07/06 最新の投稿

Hello Elena, did you apply the configuration I suggested?

Any changes?

1年前 に Jamie Sammons によって更新されました。 New Member 投稿: 5 参加年月日: 19/12/10 最新の投稿

Hi Sergio,

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

​​​​​​​

Any suggestions?

thumbnail
1年前 に Sergio Sanchez によって更新されました。 Regular Member 投稿: 149 参加年月日: 11/07/06 最新の投稿

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