Ask - Test
Lieray DXP 7.4 + Azure Cloud Front CDN
Lieray DXP 7.4 + Azure Cloud Front CDN
New Member Posts: 5 Join Date: 12/10/19 Recent PostsHi,
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.
RE: Lieray DXP 7.4 + Azure Cloud Front CDN
Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent PostsAre they world-readable, or under access control? If they're not world-readable, this would prevent CDN use on them.
RE: Lieray DXP 7.4 + Azure Cloud Front CDN
New Member Posts: 5 Join Date: 12/10/19 Recent PostsHi 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,
RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN
Liferay Legend Posts: 6441 Join Date: 9/23/08 Recent PostsTry 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)
RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN
New Member Posts: 5 Join Date: 12/10/19 Recent PostsHi,
Thanks for the ideas.. here some pics:
Here headers from local lfieray portal:
Here from the CDN:
And yes, they are world readable.
Thanks a lot for any clue...
Michael.
RE: Lieray DXP 7.4 + Azure Cloud Front CDN
Regular Member Posts: 149 Join Date: 7/6/11 Recent PostsYou can include the Cache-Control headers for requests to /documents
You can do it though Instance Settings > Documents and Media > Cache Control
RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN
New Member Posts: 5 Join Date: 12/10/19 Recent PostsHi 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,
RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN
Regular Member Posts: 149 Join Date: 7/6/11 Recent PostsHello Elena, did you apply the configuration I suggested?
Any changes?
RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN
New Member Posts: 5 Join Date: 12/10/19 Recent PostsHi Sergio,
We apply the indicated configuration but the operation remains the same.
Any suggestions?
RE: RE: Lieray DXP 7.4 + Azure Cloud Front CDN
Regular Member Posts: 149 Join Date: 7/6/11 Recent PostsI 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
Powered by Liferay™