Wildfly 11 http to https redirecting losing http method

542 Views Asked by At

i configured my wildfly 11 installation with rewrite filters to redirect from http to https. As described there: Redirect http requests to https in wildfly 10

<filters>
   <rewrite name="http-to-https" redirect="true" target="https://%v:443%U"/>
</filters>

And

<filter-ref name="http-to-https" predicate="equals(%p,80)"/>

This works perfectly for GET Requests, but if i try a POST request i get

405 Method not allowed

Does anybody know how to configure the rewrite filter to use the message type (%m, http://undertow.io/undertow-docs/undertow-docs-1.4.0/index.html)

Thank you!

1

There are 1 best solutions below

1
On

POST redirects are not well supported. See this post or this one as examples to handle this problem.

For Spring, this post shows a way to send back a different HTTP status than 301.

The short answer is that you need to use a different HTTP response code (308 Permanent Redirect). The last answer shows a way to do that.