Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

Unable to get Request custom Client headers on dispatcher

Avatar

Employee

Getting response as expected when hitting 'GET' request on Publisher with request custom headers "securitykey" and "assettype"

 

Getting 401 when hitting same GET request with same request headers on Dispatcher.

Client headers have been added in dispatcher clientheaders.

 

Screenshot 2023-06-20 at 7.08.59 PM.png

Client headers added

Tried :

Screenshot 2023-06-20 at 9.53.07 PM.png

Also tried :-

Screenshot 2023-06-20 at 3.32.59 PM.png

Dispatcher logs - don't see custom request headers in logs like securitykey or assettype although I am sure right farm file and client header file is getting picked . Log is already set to trace.

image001[39] copy.png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I want to ensure you are directly hitting the Dispatcher URL, not through CDN; in case you are hitting through CDN, the header may need to be whitelisted on CDN, also.

Also, ensure the correct dispatcher farm is resolved - the farm is enabled with the required client headers.

Regards

Albin

https://www.albinsblog.com

Albin Issac – Medium 

 

View solution in original post

7 Replies

Avatar

Community Advisor

Hello @digarg  - 

 

Could you please double-check the Dispatcher configuration file (dispatcher.any) should include a section for clientheaders where you can specify which headers are allowed to pass through to the backend server ?

Avatar

Employee

@Tanika02  Checked already , its there . snapshots attached. tried passing "*" an specific headers too 

Avatar

Community Advisor

Hi @digarg ,
Can you check if you have a filter rule enabled to allow "/enterprisedam/assetlist"?

Avatar

Employee

Yes its enabled  

/0035 { /type "allow" /url  "/enterprisedam/*" }

 

Found farm publishfarm for xxx.net

[Tue Jun 20 16:35:06 2023] [D] [pid 27037:tid 140507288164096] checking [/enterprisedam/assetlist]

[Tue Jun 20 16:35:06 2023] [D] [pid 27037:tid 140507288164096] request URL has no extension: /enterprisedam/assetlist

[Tue Jun 20 16:35:06 2023] [D] [pid 27037:tid 140507288164096] cache-action for [/enterprisedam/assetlist]: NONE

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] Filter rule entry /0035 allowed 'GET /enterprisedam/assetlist HTTP/1.1'

[Tue Jun 20 16:35:06 2023] [D] [pid 27037:tid 140507288164096] Creating new connection: 10.43.1.8:4503

[Tue Jun 20 16:35:06 2023] [D] [pid 27037:tid 140507288164096] Connected to backend 0 (10.43.1.8:4503)

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.uri = "/enterprisedam/assetlist"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[X-Forwarded-Proto] = "https"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[user-agent] = "curl/7.64.1"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[from] = "kkmmm"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[accept] = "*/*"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[host] = "xxx"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[Via] = "1.1 xxx (dispatcher)"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[X-Forwarded-For] = "xx.xx.1.19"

[Tue Jun 20 16:35:06 2023] [T] [pid 27037:tid 140507288164096] request.headers[Server-Agent] = "Communique-Dispatcher"

[Tue Jun 20 16:35:06 2023] [D] [pid 27037:tid 140507288164096] response.status = 401

Avatar

Community Advisor

The first screenshot is the way to go, you should add the headers below the "/clientheaders" section. Did you bounce your dispatcher ? Can you try to hit a different resource (i.e. a page) with those headers?



Esteban Bustamante

Avatar

Community Advisor

Hello @digarg 

 

If instead of Curl, you use postman, is it the same behaviour?


Aanchal Sikka

Avatar

Correct answer by
Community Advisor

I want to ensure you are directly hitting the Dispatcher URL, not through CDN; in case you are hitting through CDN, the header may need to be whitelisted on CDN, also.

Also, ensure the correct dispatcher farm is resolved - the farm is enabled with the required client headers.

Regards

Albin

https://www.albinsblog.com

Albin Issac – Medium