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

Getting 204-No Content from response of any POST Servlet call

Avatar

Level 1

Hi,

 

We have created first POST type Servlet call in my current project, and getting 204-No content in response. In Publisher environment, it is throwing 200 as expected. But, as we used Akamai for cache management, in Akamai URL, it is throwing this error.

 

We investigated further and found in Akamai URL, for all POST servlet calls, a Header Parameter named "Origin" got added with the value, domain name of the Akamai URL. Same issue we can replicate in POSTMAN also, when we are adding "Origin" with value - domain name of the Akamai URL in Header, it is throwing 204-No content. But if we remove that from Header in POSTMAN call, then only we are getting proper response.

 

We tried but unable to discard that header parameter "Origin" at the time of POST servlet call. From publisher environment, this header parameter is not getting added.

 

Is there any way to discard that parameter in POST Servlet call from Akamai URL ?

I have added Akamai URL' domain in the value of "alloworigin" parameter of CORS Policy config and also added the path in the value of "allowedpaths" parameter in same config.

 

Please let me know if anyone have any solution of this issue..

 

Thanks.

Topics

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

1 Accepted Solution

Avatar

Correct answer by
Employee Advisor

Thanks! But that does not look somehow problematic, can you exclude the chance that it has something to do with the custom code?

And just to confirm:

  • When you do that post (without the Origin header) to the AEM publish domain directly (bypassing Akamai), you get the expected result.
  • And when you do the very same post (without the Origin header) to the Akamai domain, you get the statuscode 204.

 

Some more checks I would recommend:

  • Have you checked the logs of the AEM instances/dispatchers to see if that request actually reached AEM?
  • Can you replicate this behavior in a different AEM environment as well?
  • How does it behave on your local development environment (or on a RDE) when you the request with the Origin header. Do you get a 204 as well?
  • Do you see this origin header also for other requests hitting AEM?

 

 

 

View solution in original post

6 Replies

Avatar

Community Advisor

Hello @dbiswas-inT ,

 

Does the servlet does its work it is intended to, regardless of its HTTP response? Meaning, does it execute without any error?

or

Is it just a concern about why the response codes are different with AEM Publisher v/s Akamai?

 

thanks,

Preetpal

Avatar

Level 1

Hi @Preetpal_Bindra ,

The servlet does work in Publisher Environment with proper response, but in Akamai URL it is giving blank response, with status code 204-No content.

 

As I looked further and found that from Akamai URL, when we are calling that servlet, the origin parameter is added(not sure where is the source of this add). In Publisher environment, it is not added.

I also checked from POSTMAN. When I am manually adding this origin parameter, same 204 response code is showing with blank response. But, when I am manually discarding that from the call, then only the response is coming correctly.

The issue is basically this blank response. 

Avatar

Employee Advisor

can you please paste the curl command, which can show this situation? What AEM version are you using?

Avatar

Level 1

AEM Version : 6.5

cURL : This is the format below. Some data is changed due to client's non-discloser agreement.

curl --location 'https://abc.com/services/category-menu/post-servlet' \
--header 'Origin: https://abc.com' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer XXX' \
--header 'Cookie: _abck=23B8B8DF83CB9285F6AA9587FB4AC7F2~-1~YAAQE0w5F3TDK5+FAQAAr0FS95YqWh+lBHadGGXSqCDe83QXzuuRH6qYM18P5q2n8XypIxM/IQBIGHCYwPEywCR/PkYYmojLHQODC365L8pZYPETWElL/W729Y+dG2uPc/ms3ko4fUVMlWeH+Mq7pS3AkXuJIN3qUwcsK6XBhu4Yw8jpEiM+RcmzeW4xvRpMkLOswy8WSSXFidKpccvGrCsknG6Y4L5xSFm7YGC/rHyf7zsNMJZa4AfXT2GwO07wNZw4fbLC1X3g6Suod1H9W34A87S1dDMM7HR5JMMCx7O+WAvJRmITzqOf9E5+8EpA+lYDMtRrA5ImTaIjeK8qpMLhy1Iid0aXzjz8xP/l6oEw1WeDREm~-1~-1~-1; QA_ORIGIN=OLD; abE1=Y100; affinity="b9fb81e00119addc"' \
--data '{
    "sku":"11171",
    "quantity":"2.0",
    "zipcode":"03833",
    "currentProductId":"11930",
    "existingProductIDs":"11930:2015",
    "field": "L2NvbnRlbnQvZGFtL3RzYy1hZW0tcGRwL2NvbnRlbnQtZnJhZ21lbnRzL2VuL2VzcG90cpb24tY2Y=",
    "stlocId":"161"
}'

 

Response : Blank

 

Avatar

Correct answer by
Employee Advisor

Thanks! But that does not look somehow problematic, can you exclude the chance that it has something to do with the custom code?

And just to confirm:

  • When you do that post (without the Origin header) to the AEM publish domain directly (bypassing Akamai), you get the expected result.
  • And when you do the very same post (without the Origin header) to the Akamai domain, you get the statuscode 204.

 

Some more checks I would recommend:

  • Have you checked the logs of the AEM instances/dispatchers to see if that request actually reached AEM?
  • Can you replicate this behavior in a different AEM environment as well?
  • How does it behave on your local development environment (or on a RDE) when you the request with the Origin header. Do you get a 204 as well?
  • Do you see this origin header also for other requests hitting AEM?

 

 

 

Avatar

Level 2

@Jörg_Hoh  - I am facing the same issue where the post servlet is accessed via AWS domain is giving out 204 no content response. The same is working via Postman where the servlet is redirecting to the success page. 

 

Could you please help us why dispatcher is returning the 204 no content when accessed via an AWS domain. We have replicated this in the RDE and in the DEV environments as well.