Message "301 Moved Permanently" began to appear suddenly

2

I have two applications that worked perfectly, but without any changes to the code, they do not work anymore.

On the one hand, an application with a JSP doing a POST call and passing two hidden parameters:

<li>
 <form name="login" method="post" action="http://dominio.com/aplicacao/chamadaApp">
  <input type="hidden" name="param1" value="conteudo1">
  <input type="hidden" name="param2" value="conteudo2">
  <A href="javascript:login()" class="classe1"></A>
  <script type="text/javascript">
   function login()
   {
    document.login.submit();
   }
  </script>
 </form>
</li>

On the other hand, another SpringMVC application with the following code snippet, receiving the above request:

@RequestMapping(value = "/chamadaApp", method = RequestMethod.POST)
    public ModelAndView login(
      @RequestParam(value = "param1", required = false) String param1,
      @RequestParam(value = "param2", required = false) String param2,
      WebRequest request) {
 //código
}

It worked perfectly, but suddenly the SpringMVC application started to return the HTTP Status 405 - Request method 'GET' not supported error. This makes no sense since both the HTML makes a POST call and the application also expects to receive a POST call.

Investigating a little more, I discovered with FIREBUG that when performing the APp call, before showing the above error, the status is returned: 301 Moved Permanently , which made me suspect some problem below, but I have no idea what it can be.

Does anyone know what this error means and how to solve it?

    
asked by anonymous 24.06.2014 / 23:40

1 answer

2

This looks like a badly configured reverse proxy , which is redirecting calls to the web server incorrectly.

Given its HTML code and the Spring Controller method, plus information that the system has not been modified, there is no reason to think the problem is in the application.

Analyze the access logs of your application server to see what kind of request the application server is receiving.

If you are "leaving" a POST of Firefox and getting a GET on the application server, then you "killed" the riddle and you know the problem is in the configuration below.

You can also analyze the header of requests arriving at the application server by looking for headers redirect , such as:

  • X-Forwarded-For
  • X-Forwarded-Host
  • X-Forwarded-Server
24.06.2014 / 23:53