response servlet, custom header does not available | Community
Skip to main content
June 12, 2024
Solved

response servlet, custom header does not available

  • June 12, 2024
  • 2 replies
  • 771 views

Hi all.

We have a servlet that returns a custom header:

 

response.addHeader(“msg-error”, “err2”);

 

In author it works correctly and returns the header. In the dispatcher domain it does not return the header, we think that the error is in the configuration of the dispatcher or Fastly.

 

In the dispatcher we have tested, adding the header "msg-error", to the custom header of the site, in the farm we have referenced the file Mysite_clientheaders.any

 

Mysite_clientheaders.any

“msg-error”

$include “./default_clientheaders.any”

 

But it still doesn't work, any idea what else we should configure?

Best Regards.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by jorganer

We have already found the problem,

The servlet returns a 403 error, in the servlet we included the custom header..

The problem was in the configuration of the virutal host, it had this value

DispatcherPassError 1

The 403 error is returned by the dispatcher and not by AEM publish.

We have set:
DispatcherPassError 0
Now the error is handled by AEM publish and returns our custom header.

Thank you very much.

2 replies

abhishekanand_
Community Advisor
Community Advisor
June 12, 2024

Hi @jorganer 

  • verify that the dispatcher is properly forwarding requests to the backend servlet.
  • check the Fastly configuration for any rules or settings related to custom headers. Fastly allows you to read and write HTTP headers using VCL(although i have never used it)
  • in your Mysite_clientheaders.any file, you’ve added the custom header “msg-error.”
    Make sure that the syntax is correct, and the header is properly included.
    Double-check that the $include "./default_clientheaders.any" statement is correctly referencing the default client headers.
Abhishek Anand
jorganerAuthorAccepted solution
June 12, 2024

We have already found the problem,

The servlet returns a 403 error, in the servlet we included the custom header..

The problem was in the configuration of the virutal host, it had this value

DispatcherPassError 1

The 403 error is returned by the dispatcher and not by AEM publish.

We have set:
DispatcherPassError 0
Now the error is handled by AEM publish and returns our custom header.

Thank you very much.