Expand my Community achievements bar.

SOLVED

\/clientheaders in dispatcher

Avatar

Level 7

Hi Team,

 

/clientheaders in dispatcher is used for validation the headers or just adding headers into request headers ? As well as please give me an example how to add content type or cross origin policies through clientheaders ?

 

Thanks 

 

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

With this configuration you can just define the name of the HTTP header, which is copied over from the request the user made to the dispatcher into the request the dispatcher makes to AEM. You cannot add custom headers with specific values into the request to AEM with this configuration parameter.

View solution in original post

5 Replies

Avatar

Community Advisor

Hello @JakeCham 

 

The /clientheaders is meant to define the headers that can pass-through from client to AEM.

 

For content-type refer to following:

/clientheaders { 
  # Retain any existing headers
  "CSRF-Token"
  "X-Forwarded-Proto"
  "referer"
  "user-agent"
  "authorization"
  "from"
  "content-type"
   ....
}

 

For CORS, please refer to https://experienceleague.adobe.com/docs/experience-manager-learn/foundation/security/understand-cros...

/clientheaders {
   ...
   "Origin"
   "Access-Control-Request-Method"
   "Access-Control-Request-Headers"
}

Example for custom-header is available on: https://techrevel.blog/2023/09/05/exploring-aem-request-and-response-headers-analysis-of-browser-cdn...


Aanchal Sikka

Avatar

Level 7

Hi @aanchal-sikka 

 

Can't we give content type like below 
/clientheaders{

"Content-Type" "application/json"

}

 

Or can you give me an example for below

  • Content-Type: define the media type or MIME type of the response content. 

Avatar

Correct answer by
Employee Advisor

With this configuration you can just define the name of the HTTP header, which is copied over from the request the user made to the dispatcher into the request the dispatcher makes to AEM. You cannot add custom headers with specific values into the request to AEM with this configuration parameter.

Avatar

Administrator

@JakeCham Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community.



Kautuk Sahni