Getting http 405 for POST method
armahdi Aug 22, 2016 10:47 PMI am getting a 405 return code for POST request in wildfly 10 which is otherwise working on a jboss 5.0. When i deploy the same application on Wildfly, somehow Wildfly doesnt like the POST method I started logging the http requests in the unertow by using this post
I started getting the http dumps like this:
17:17:03,794 INFO [io.undertow.request.dump] (default task-15)
----------------------------REQUEST---------------------------
URI=/clapp/webstart/images/orta_icon.jpg
characterEncoding=null
contentLength=-1
contentType=null
header=Accept=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
header=Connection=keep-alive
header=Cache-Control=no-cache
header=accept-encoding=gzip
header=UA-Java-Version=1.8.0_91
header=Pragma=no-cache
header=User-Agent=JNLP/1.7.0 javaws/11.91.2.15 (<internal>) Java/1.8.0_91
header=Host=X.X.X.X:8080
locale=[]
method=GET
protocol=HTTP/1.1
queryString=
remoteAddr=dever.orta.net/X.X.X.X:55550
remoteHost=dever.orta.net
scheme=http
host=X.X.X.X:8080
serverPort=8080
--------------------------RESPONSE--------------------------
contentLength=1919
contentType=image/jpeg
header=Connection=keep-alive
header=Last-Modified=Thu, 18 Aug 2016 02:52:30 GMT
header=X-Powered-By=Undertow/1
header=Server=WildFly/10
header=Content-Type=image/jpeg
header=Content-Length=1919
header=Date=Mon, 22 Aug 2016 07:17:03 GMT
status=200
==============================================================
17:17:06,927 INFO [io.undertow.request.dump] (default I/O-11)
----------------------------REQUEST---------------------------
URI=/ortaopenint/openint
characterEncoding=null
contentLength=271
contentType=[application/x-www-form-urlencoded]
header=Accept=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
header=Connection=keep-alive
header=Content-type=application/x-www-form-urlencoded
header=Content-Length=271
header=User-Agent=Java/1.8.0_91
header=Host=X.X.X.X:8080
locale=[]
method=POST
protocol=HTTP/1.1
queryString=
remoteAddr=dever.orta.net/X.X.X.X:55550
remoteHost=dever.orta.net
scheme=http
host=X.X.X.X:8080
serverPort=8080
--------------------------RESPONSE--------------------------
contentLength=0
contentType=null
header=Connection=keep-alive
header=X-Powered-By=Undertow/1
header=Server=WildFly/10
header=Location=http://X.X.X.X:8080/ortaopenint/openint/
header=Content-Length=0
header=Date=Mon, 22 Aug 2016 07:17:06 GMT
status=307
==============================================================
17:17:06,929 INFO [io.undertow.request.dump] (default task-16)
----------------------------REQUEST---------------------------
URI=/ortaopenint/openint/
characterEncoding=null
contentLength=271
contentType=[application/x-www-form-urlencoded]
header=Accept=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
header=Connection=keep-alive
header=Content-type=application/x-www-form-urlencoded
header=Content-Length=271
header=User-Agent=Java/1.8.0_91
header=Host=X.X.X.X:8080
locale=[]
method=POST
protocol=HTTP/1.1
queryString=
remoteAddr=dever.orta.net/X.X.X.X:55545
remoteHost=dever.orta.net
scheme=http
host=X.X.X.X:8080
serverPort=8080
--------------------------RESPONSE--------------------------
contentLength=104
contentType=text/html;charset=UTF-8
header=Connection=keep-alive
header=X-Powered-By=Undertow/1
header=Server=WildFly/10
header=Content-Type=text/html;charset=UTF-8
header=Content-Length=104
header=Date=Mon, 22 Aug 2016 07:17:06 GMT
status=405
==============================================================
Using this post (https://forum.camunda.org/t/enable-cors-on-wildfly/673/2) i started getting the below but it still kept on sending 405 on POST.
----------------------------REQUEST---------------------------
URI=/ortaopenint/openint
characterEncoding=null
contentLength=271
contentType=[application/x-www-form-urlencoded]
header=Accept=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
header=Connection=keep-alive
header=Content-type=application/x-www-form-urlencoded
header=Content-Length=271
header=User-Agent=Java/1.8.0_91
header=Host=dever.orta.net:8080
locale=[]
method=POST
protocol=HTTP/1.1
queryString=
remoteAddr=dever.orta.net/X.X.X.X:57843
remoteHost=dever.orta.net
scheme=http
host=dever.orta.net:8080
serverPort=8080
--------------------------RESPONSE--------------------------
contentLength=0
contentType=null
header=X-Powered-By=Undertow/1
header=Access-Control-Allow-Headers=accept, authorization, content-type, x-requested-with
header=Server=WildFly/10
header=Location=http://dever.orta.net:8080/ortaopenint/openint/
header=Date=Mon, 22 Aug 2016 08:01:37 GMT
header=Connection=keep-alive
header=Access-Control-Allow-Origin=*
header=Access-Control-Allow-Credentials=true
header=Content-Length=0
header=Access-Control-Max-Age=1
header=Access-Control-Allow-Methods=GET, POST, OPTIONS, PUT
status=307
==============================================================
18:01:37,890 DEBUG [org.jboss.weld.Reflection] (default task-7) WELD-000620: interface javax.enterprise.inject.Decorated is not declared @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use this annotation, however this may make the application unportable.
18:01:37,891 DEBUG [org.jboss.weld.Reflection] (default task-7) WELD-000620: interface javax.enterprise.inject.Intercepted is not declared @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use this annotation, however this may make the application unportable.
18:01:37,894 INFO [io.undertow.request.dump] (default task-7)
----------------------------REQUEST---------------------------
URI=/ortaopenint/openint/
characterEncoding=null
contentLength=271
contentType=[application/x-www-form-urlencoded]
header=Accept=text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
header=Connection=keep-alive
header=Content-type=application/x-www-form-urlencoded
header=Content-Length=271
header=User-Agent=Java/1.8.0_91
header=Host=dever.orta.net:8080
locale=[]
method=POST
protocol=HTTP/1.1
queryString=
remoteAddr=dever.orta.net/X.X.X.X:57842
remoteHost=dever.orta.net
scheme=http
host=dever.orta.net:8080
serverPort=8080
--------------------------RESPONSE--------------------------
contentLength=104
contentType=text/html;charset=UTF-8
header=X-Powered-By=Undertow/1
header=Access-Control-Allow-Headers=accept, authorization, content-type, x-requested-with
header=Server=WildFly/10
header=Date=Mon, 22 Aug 2016 08:01:37 GMT
header=Connection=keep-alive
header=Access-Control-Allow-Origin=*
header=Access-Control-Allow-Credentials=true
header=Content-Type=text/html;charset=UTF-8
header=Content-Length=104
header=Access-Control-Max-Age=1
header=Access-Control-Allow-Methods=GET, POST, OPTIONS, PUT
status=405
===========================================================
How can I enable POST method in wildfly. I thought the last change would actually solve this but some how it didnt. any hints or pointers will be appreciated.
the actual standalone.xml config is as follows:
<subsystem xmlns="urn:jboss:domain:undertow:3.0">
<buffer-cache name="default"/>
<server name="default-server">
<http-listener name="default" socket-binding="http" redirect-socket="https"/>
<host name="default-host" alias="localhost">
<location name="/" handler="welcome-content"/>
<filter-ref name="server-header"/>
<filter-ref name="x-powered-by-header"/>
<filter-ref name="request-dumper"/>
<filter-ref name="Access-Control-Allow-Origin"/>
<filter-ref name="Access-Control-Allow-Methods"/>
<filter-ref name="Access-Control-Allow-Headers"/>
<filter-ref name="Access-Control-Allow-Credentials"/>
<filter-ref name="Access-Control-Max-Age"/>
</host>
</server>
<servlet-container name="default">
<jsp-config/>
<websockets/>
</servlet-container>
<handlers>
<file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
</handlers>
<filters>
<response-header name="server-header" header-name="Server" header-value="WildFly/10"/>
<response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
<filter name="request-dumper" class-name="io.undertow.server.handlers.RequestDumpingHandler" module="io.undertow.core" />
<response-header name="Access-Control-Allow-Origin" header-name="Access-Control-Allow-Origin" header-value="*"/>
<response-header name="Access-Control-Allow-Methods" header-name="Access-Control-Allow-Methods" header-value="GET, POST, OPTIONS, PUT"/>
<response-header name="Access-Control-Allow-Headers" header-name="Access-Control-Allow-Headers" header-value="accept, authorization, content-type, x-requested-with"/>
<response-header name="Access-Control-Allow-Credentials" header-name="Access-Control-Allow-Credentials" header-value="true"/>
<response-header name="Access-Control-Max-Age" header-name="Access-Control-Max-Age" header-value="1"/>
</filters>
</subsystem>
Message was edited by: Syed Mahdi Added the actual standalone.xml undertow config