400 Bad Request when using Glassfish REST API

When you try to automate your Glassfish administration duties with its REST API using POST or DELETE methods, and all you get is HTTP response 400 and zero content, you forgot to read this:

REST requests that add, update, or delete objects must specify the X-Requested-By header with the value GlassFish REST HTML interface.

It is intended to prevent CSRF attacks as noted in Jason's Lee post.

Eduardo
September 9th, 2015 23:37

Dudits, you saved my day !

I was ripping my hair off trying to figure out what's wrong and totally missed that note. Thanks a lot for posting this !

*Name
*Mail
Website
Comment