"No resource method found for GET, return 405 with Allow header" but doing a POST request

Peter Frisch picture Peter Frisch · Feb 16, 2018 · Viewed 10k times · Source

I'm having a problem accessing my rest endpoint. I'm trying to do a login with a POST request, but keep getting

ERROR [org.jboss.resteasy.resteasy_jaxrs.i18n] (default task-36) RESTEASY002010: Failed to execute: javax.ws.rs.NotAllowedException: RESTEASY003650: No resource method found for GET, return 405 with Allow header

I'm using Postman for testing, so I'm pretty sure I actually create a POST request and not a GET request.

On the server I use a CORS filter and looking at the header in the response, I think it's working:

Access-Control-Allow-Credentials →true
Access-Control-Allow-Headers →origin, content-type, accept, authorization
Access-Control-Allow-Methods →GET, POST, PUT, DELETE, OPTIONS, HEAD
Access-Control-Allow-Origin →*
Access-Control-Max-Age →1209600
Allow →POST, OPTIONS
Allow →GET, POST, PUT, DELETE, OPTIONS, HEAD
Connection →keep-alive
Content-Length →0
Date →Fri, 16 Feb 2018 17:47:04 GMT
Server →nginx/1.10.3 (Ubuntu)
X-Powered-By →Undertow/1

(Yes, I'm aware it's not the safest idea to allow ALL origins, and virtually eternity for max age. But I can restrict this further, when I worked around my current problem).

As for the server setup: I'm running Wildfly 11.0.0 Alpha1 and Nginx for an Angular5 Application that ultimately is supposed to do the login.

Any suggestions where to look for the cause of this problem?

Answer