Expand my Community achievements bar.

SOLVED

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

Avatar

Level 6

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

1 Accepted Solution

Avatar

Correct answer by
Administrator

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

View solution in original post

4 Replies

Avatar

Level 10

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. 

Avatar

Level 8

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.

Avatar

Correct answer by
Administrator

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

Avatar

Level 2

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