Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

response servlet, custom header does not available

Avatar

Level 2

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.

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Level 2

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.

View solution in original post

2 Replies

Avatar

Level 6

Hi @JoseManuel121 

  • 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.

Avatar

Correct answer by
Level 2

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.