Using Postman to test POST on a servlet - getting 403 error | Community
Skip to main content
New Participant
July 22, 2016
Solved

Using Postman to test POST on a servlet - getting 403 error

  • July 22, 2016
  • 4 replies
  • 15319 views

I am trying to test my doPost method on my localhost.

I have removed POST method from the Apache Sling Referrer Filter.

I have checked that

check that the POST method is NOT in the filter methods of the CSRF filter config

http://localhost:4502/system/console/configMgr/com.adobe.granite.csrf.impl.CSRFFilter.

But my post request in Postman returns 403 -  Forbidden - Authentication Failed

I would appreciate it if anyone has had experience with testing doPost methods in a sling servlet from a rest client if they could assist.

 

regards

Clive Stewart

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by kautuk_sahni

Hi

Please try this:-

1. http://localhost:4502/system/console/configMgr

2. Search for 'Apache Sling Referrer Filter'

3. Remove POST method from the filter. Then you can call your POST method anywhere.

4. Select “Allow Empty”

I hope this would help you.

~kautuk

4 replies

sourcedcode
New Participant
March 31, 2018

Checkout this blog post I created with video instructions on how to prepare your REST Client to make posts requests to your AEM Author Instance - How to make a simple HTTP POST request to AEM with a HTTP Rest Client, Postman – Sourced Code

kautuk_sahni
kautuk_sahniAccepted solution
Employee
July 29, 2016

Hi

Please try this:-

1. http://localhost:4502/system/console/configMgr

2. Search for 'Apache Sling Referrer Filter'

3. Remove POST method from the filter. Then you can call your POST method anywhere.

4. Select “Allow Empty”

I hope this would help you.

~kautuk

Kautuk Sahni
New Participant
July 22, 2016

You're posting to the author instance so make sure you are supplying a valid username and password to generate an authorization header.  You can choose the authorization type of "Basic Auth" and once you supply the username/password, you can press "Update Request" to generate the header that's needed.

smacdonald2008
New Participant
July 22, 2016

See my Java Swing article that posts files to AEM nodes. You can try the same thing to test your servlet - see the syntax of the servlet: 

https://helpx.adobe.com/experience-manager/using/post_files.html

PS - this is my main way of uploading files (JAR, JS, etc) to AEM nodes.