title: Get rid of POST/redirect/GET pattern
body: <p>I noticed that whenever I do POST request and redirect in Spring, it is redirected to GET request. Is there any setting to turn this behavior off? I would like POST be redirected to POST.</p>
  
  <p>I need it for two reasons:</p>
  
  <ol>
  <li>We serve application over http and https. Http is redirected to https with a connector:</li>
  </ol>
  
  <pre><code>@Bean
  public ServletWebServerFactory servletContainer() {
          TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory() {
              @Override
              protected void postProcessContext(Context context) {
                  SecurityConstraint securityConstraint = new SecurityConstraint();
                  securityConstraint.setUserConstraint("CONFIDENTIAL");
                  SecurityCollection collection = new SecurityCollection();
                  collection.addPattern("/*");
                  securityConstraint.addCollection(collection);
                  context.addConstraint(securityConstraint);
              }
          };
          tomcat.addAdditionalTomcatConnectors(getHttpConnector());
          return tomcat;
      }
  
      private Connector getHttpConnector() {
          Connector connector = new Connector(TomcatServletWebServerFactory.DEFAULT_PROTOCOL);
          connector.setScheme("http");
          connector.setSecure(false);
          ...
          connector.setPort(httpPort);
          ...
          connector.setRedirectPort(httpsPort);
          return connector;
      }
  </code></pre>
  
  <p>Everything is fine with online authentication. User comes over HTTP, is redirected to HTTPS, login page is displayed. Authentication goes over HTTPS.</p>
  
  <p>Problems occur with API authentication. I need a way to authenticate users directly from url. For example: [POST] <a href="http://myapp/api" rel="nofollow noreferrer">http://myapp/api</a>
  Credential information are passed in request body. This request is redirected to HTTPS, but body is lost. Do you think that enabling HTTP in this case is insecure and we should resign from it?</p>
  
  <ol start="2">
  <li>We have a lot of legacy code, where frontend is built on one url - additional parameters specify which handler should handle given request. To avoid rewriting frontend we have a forward that sends requests to respective urls.</li>
  </ol>
  
  <pre><code>return new ModelAndView("forward:/" + action + "?" + extraParams + bodyParams);  
  </code></pre>
  
  <p>This works, however I can imagine that in some cases body will be too large to be passed over GET in a url.</p>
  
  <p>Technology:
  Spring boot: 2.0.6</p>