2

I'm rewriting the problem, to put more details.

I set up a jss app in a docker container. It's working fine, even the Experience Editor has already been put to work in this environment.

It turns out that the communication between the jss app container and the CM container is communicating smoothly with the hostname (http://cm). However, when I get it from my browser, it comes with http://cm in the image url, as the GraphQL call is made between the jss app container (nodejs) and the CM container (sitecore). As what comes in the url of the image is http://cm, I can't get it from my computer's browser, because to call the traefic it should be https://cm.maverick-docker.localhost

Networks

JSS APP on my browser

How to make the sitecore return the images with the public url of the CM, not with the internal url?

CM: CM

JSS APP: JSS APP

4
  • Can you please share your docker compose file(s) ? Nov 18, 2022 at 20:32
  • yea, would need the docker-compose files. However, the CM might be configured to only talk in https, which you would need to disable for your scenario to work.
    – Mark Cassidy
    Nov 18, 2022 at 20:53
  • Could you please hostname in docker file what you are providing because in image url hostname is cm? Nov 19, 2022 at 5:29
  • vincent-lui, mark-cassidy, abhinav-singh I updated the post, are there any changes that do you need? Nov 21, 2022 at 20:02

1 Answer 1

0

I altered the configurations to it don't includes the server url in media urls:

<?xml version="1.0"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:set="http://www.sitecore.net/xmlconfig/set/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
    <sitecore>
        <layoutService>
            <configurations>
                <config name="default">
                    <rendering type="Sitecore.LayoutService.Configuration.DefaultRenderingConfiguration, Sitecore.LayoutService">
                        <renderingContentsResolver type="Sitecore.LayoutService.GraphQL.LayoutService.GraphQLAwareRenderingContentsResolver, Sitecore.LayoutService.GraphQL" resolve="true" patch:source="Sitecore.LayoutService.GraphQL.config">
                            <IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
                        </renderingContentsResolver>
                        <renderingContentsResolver type="Sitecore.LayoutService.ItemRendering.ContentsResolvers.RenderingContentsResolver, Sitecore.LayoutService">
                            <IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
                        </renderingContentsResolver>
                    </rendering>
                </config>
                <config name="sxa-jss">
                    <rendering>
                        <renderingContentsResolver type="Sitecore.XA.JSS.Foundation.Presentation.ContentsResolvers.RenderingContentsResolver, Sitecore.XA.JSS.Foundation.Presentation">
                            <IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
                        </renderingContentsResolver>
                    </rendering>
                </config>
                <config name="jss">
                    <rendering type="Sitecore.LayoutService.Configuration.DefaultRenderingConfiguration, Sitecore.LayoutService">
                        <renderingContentsResolver type="Sitecore.LayoutService.ItemRendering.ContentsResolvers.RenderingContentsResolver, Sitecore.LayoutService">
                            <IncludeServerUrlInMediaUrls>false</IncludeServerUrlInMediaUrls>
                        </renderingContentsResolver>
                    </rendering>
                </config>
            </configurations>
        </layoutService>
    </sitecore>
</configuration>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.