Hi everyone, I'm facing an issue when accessing a servlet (POST) via ajax from dispatcher.
Everything works well in my local and author mode.I've removed POST method in "com.adobe.granite.csrf.impl.CSRFFilter.cfg" as well as allowed the path in filters.any.
Here's my config:
Remove for privacy
Do you guys have any idea for this issue? Please correct me if i'm wrong in any step.
Thanks.
Solved! Go to Solution.
Views
Replies
Total Likes
Hi everyone, My issue has been resolved, The code is correct at all. I just forgot to uncheck ignore web tier configuration on a pipeline configuration. So the dispatcher wasn't deployed
As you have already confirmed it works fine in local publisher (it means you have enabled post method in servlet class and felix config also). I believe your servlet path is /bin/pdf/view and in filters.any it is allowing only GET method in your screenshot. Just allow post method for the same path.
Thanks, @shashi_c .You probably misunderstood something. I registered the sling servlet that I mentioned above as resourceType with selector = 'dataForm' and extension = 'json'. the path bin/pdf/view is another servlet.
Test the following:
1. Test your servlet on publisher directly, you can use postman for it.
If the servlet is working fine on the publisher, then
2. Check dispatcher logs for any error for your servlet path
3. Also, you can try updating your rule 0107 by adding /method "POST"
Hi @Mohit_KBansal .
I tested the servlet on postman and it returned the same issue as dispatcher. (404 not found)
Now it makes sense. Please check this discussion [1], I hope you will find some direction.
I can access the servlet on publisher instance locally (4503) but not in server.
I just set a dispatcher up on local and i worked well. Not sure how it didn't work on server
Hi @luongpham1994
In Filter.any file have you allowed the Post servlet that you have registered through resourceType. Can't see it in attached screen print.
Yes, I did.
I tested it on the local dispatcher, When committed to the allowed path, The path is not found, and it worked again when uncommented. So I think the filters is working correctly
Hi everyone, My issue has been resolved, The code is correct at all. I just forgot to uncheck ignore web tier configuration on a pipeline configuration. So the dispatcher wasn't deployed
Views
Likes
Replies