How can I use the same media url between the page builder and live site?

Luis Youn asked on November 10, 2019 23:31

Hi there,

I have an issue on the image url between the page builder and the live site.

Once I attached files, I found that the image urls are different between the page builder and the live site. For example, in the page builder , the image url is "https://[OUR-DOMAIN]/cmsctx/pv/administrator/culture/en-AU/wg/52761417-63a6-4989-8008-a74476751cfb/readonly/0/ea/1/h/b49bf010dc67edf0691835b6b2e5b4e35fc00fdd410bcbc745befbd6a7bf1c30/-/k12media/getattachment/5fd46d88-fe94-478e-ac20-f91b20d3cdc0/awards-1.png?uh=c78b56a2c50e1aa2d9fdf4cd5890189bca2516d410ee63f8b61199ba7ca70060&administrationurl=https%3A%2F%2Fadmin.stagingcms.rest.com.au%2F". But, in the live site , it is "https://[OUR-DOMAIN]/k12media/getattachment/5fd46d88-fe94-478e-ac20-f91b20d3cdc0/awards-1.png"

How can I use the same image url of the live site in the page builder or preview? I am using UrlHelper.Kentico().ImageUrl to create the image urls.

Thanks in advance,

Luis

Recent Answers


Mike Wills answered on November 11, 2019 03:15

Hi Luis,

Is having a different version of the attachment URLs in the page builder causing a problem? The image URLs are supposed to be different in preview mode, because Kentico is adding security and context information to the preview URL to allow draft versions of the content, including images to be previewed. You want this when working with pages in the Page Builder, but not when viewing the live site, where you only want published content to be viewed using the context established by the end users.

If the virtual context information isn't added to the preview URL of attachments, then the MVC app would not be able to authenticate access to non-published versions of the page attachments.

If you want to use the same URL in page builder as would be used in the live site, you could construct the image URL without using the helper methods. However, this would cause you to only see the published version of attachments when using the page builder. And, if there was not yet a published version of the attachment, you'd probably get a 401 response in the page builder.

Does this help?

Mike

0 votesVote for this answer Mark as a Correct answer

Luis Youn answered on November 11, 2019 05:44 (last edited on November 11, 2019 05:44)

Hi Mike,

Thank you for your detail answer first of all.

Then, let me have a question about the attachment urls related to the license.

Actually, I have two sites, one is for development, the other is for staging. But they have different licence. One is "Free" (because it passed the trial period), the other is "Enterprise marketing solution".

In the development server, the attachment urls between the page builder and live site are same, but the staging server has different urls. I compared the most config & settings. But I can't figure out why the staging server has different urls.

Does the license affect the attachment url?

Thanks in advance,

Luis

0 votesVote for this answer Mark as a Correct answer

Mike Wills answered on November 11, 2019 06:42

Hi Luis,

It could make a difference. Can you request an EMS key for the server that is running a free licences and try it? That's probably the easiest way to rule it out.

Mike

0 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on November 12, 2019 15:57

The only thing which would be affected by the license, in this case, would be the number of documents you have in the "FREE" version. If you have more than 1000 documents and you were uploading "file" page types with attachments, then you'd get an error about meeting the 1000 page/document limit.

As far as generating the link/url, there is no license limitation. I'm assuming you're using MVC for this project in v12 correct? If so, are your web farm servers properly working/syncing the data from Kentico CMS to the MVC site?

1 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.