There should be no need to patch the IncludeServerUrlInMediaUrls
when deploying on to Vercel. The url you are showing clearly shows the server url from the docker container https://cm/-/media
, this would not be the url coming from your XM Cloud CM instance.
Also, the correct config name to patch for XM Cloud would be sxa-jss
, not default
or jss
.
PUBLIC_URL set incorrectly
Your issue looks to be created by the PUBLIC_URL
environment variable, locally, this PUBLIC_URL
would be set to either http://localhost:3000
or https://www.sxastarter.localhost
(or whatever your web application url is in docker). This value is set for editing only.
For Vercel deployments, this environment variable must be set to a blank or empty string, then your JS, CSS and Images paths will be relative.
If you are using the Preview Edge endpoint on for your site, the Next.config.js
contains a redirect for your images to point at your Sitecore Api Host url - so make sure you set that environment variable, if you are using the production Edge endpoint, all media urls are rewritten to an edge.sitecorecloud.io
CDN url. You will need to make sure that this is configured in your next.config.js
for image optimization.