Hey Community,
Hope you're doing well.
I'm facing an issue with reading headers such as clientId
, clientSecret
, and orgId
in the AEM cloud publish URL and domain URL via POSTMAN. I have a servlet where I'm reading all these headers, and it's working fine on localhost but not in DEV.
Has anyone encountered a similar situation? Any insights would be greatly appreciated.
Solved! Go to Solution.
Topics help categorize Community content and increase your ability to discover relevant content.
Views
Replies
Total Likes
Can you please check if you have added these headers in
Beloe os the correct way to read any header for http protocol, request.getHeader(). For example to read User-Agent from below header, request.getHeader("User-Agent"))
Please check one in browser console or print as part of error.log all header we are getting and validate the required one is there or not.
Can you please check if you have added these headers in
Hello @Prince_Shivhare
Requesting you to please check, if this helps https://techrevelhub.wordpress.com/2023/09/05/exploring-aem-request-and-response-headers-analysis-of...
Step-1: Configure AEM Dispatcher to allow custom headers to pass-through
This you can validate from Dispatcher logs. Details are present on blog
Step-2: Whitelist custom headers on CDN
If the dispatcher is sending the response headers, but you're not receiving them, it's possible that they're being blocked by the CDN.
I'm unsure about the process on Fastly for Cloud and whether an Adobe ticket is required for this issue. However, please share your findings
It was /clientheaders where I had to allow the custom header. but then I got another error while trying to connect to the exchange token URL internally via servlet.
So basically I am first generating the JWT token using the privatekey.pem file and then hitting the exchange URL internally via servlet to generate the access token so that I can access the AEM author environment to access the resource.
String body = "client_id=" + URLEncoder.encode(clientId, "UTF-8") + "&" + "client_secret="
+ URLEncoder.encode(clientSecret, "UTF-8") + "&" + "jwt_token=" + URLEncoder.encode(jwtToken, "UTF-8");
try (DataOutputStream outputStream = new DataOutputStream(connection.getOutputStream())) {
outputStream.writeBytes(body);
}
try (BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String inputLine;
StringBuffer stringBuffer = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
stringBuffer.append(inputLine);
}
response.getWriter().print(stringBuffer);
}
I followed the below URL but not sure what is casuing the issue. do I have to allow my cloud instance to access EXCHANGE TOKEN url?
It's working well in localhost and breaking in DEV in second try statement.
@Prince_Shivhare 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.
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies