Hello there, I'm facing a strange issue when I try to make a POST request from my frontend(I'm currently using React, but i'm doing these requests from localhost:4502). I know for sure that the servlet it's working because when I do a POST request from Postman works correctly. When I do it from the frontend it gives me 403(Forbidden). Why it has different behaviour when I do the legit same things?
Info about servlet:
Servlet temporary binded to /bin/vendorname/utils
Views
Replies
Total Likes
You should check CORS configuration, check the allowed method types,
"supportedmethods"
Understand Cross-Origin Resource Sharing (CORS) with AEM | Adobe Experience Manager
Thank you for your answer @Nitin_laad
Currently my cors settings are:
allowedorigins: "http://localhost:3000"
allowedmethods(supportedmethods): ["GET", "POST", "HEAD"]
supportedheaders: [ "Authorization", "Origin", "Accept", "X-Requested-With", "Content-Type", "Access-Control-Request-Method", "Access-Control-Request-Headers"]
@lezzowski1 You may have to remove the POST value from the filter in "Apache Sling Referrer Filter" and "Adobe Granite CSRF Filter" configuration - http://localhost:4502/system/console/configMgr
Hi @lezzowski1 ,
Please refer similar query here: https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/page-not-redirecting-on-fo...
Hope that helps!
Regards,
Santosh
hi,
You need to pass the authentication(credentials with post request) since it is Author.
Try in publish instance, it should work.
Good news, my servlet is currently working while binded on path but if I try to bind it on a component with SlingServletResourceTypes my request status code is 200 but it does nothing. It just says Content Modified or something similar instead of my json. Any thoughts?
Can you share, how did you registered the servlet.
Better to use selector to avoid resolution of default post servlet.
Seems like the problem was this one: I wasn't setting "methods = "POST" " in the decorator. I'm kinda shocked because why should the servlet work as intended when binded to path (and I didn't explicitly set "methods = POST") but not when binded to component? It's totally crazy
Views
Likes
Replies