1

We are using Sitecore 10.2/Headless/JSS React, also we enabled server-side rendering by hosting behind the Headless JSS proxy.

We require every layout service to authenticate in the backend(Sitecore), and we need to set a custom authorize header for every layout service call. Especially we need this on the server side.

1 Answer 1

3

This is doable in Node JS reverse proxy template.

  1. Go to \src\config.ts
  2. Under the ProxyConfig => proxyOptions. Basically, this is http-proxy-middleware, so you can customize it like here.
  3. Add the example of the below line,
   /*
   * Add custom headers for the layout service here
   */
    onProxyReq: function (proxyReq: any) {
        proxyReq.setHeader('Authorization', "Value here");          
    }

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.