title: 502 Bad Gateway with Tomcat
body: <p>I have a web application running on an ubuntu server. </p>
  
  <p>I use HAProxy as a proxy that points to my webserver, which is Tomcat 7. My application runs on a servlet. My Servlet is build from a Grails application. I also use the <a href="http://grails.org/plugin/resources" rel="nofollow noreferrer">Resource</a> plugin for Grails, which should handle the resoures correctly. Everthing works fine but sometimes I see this error in the browser: </p>
  
  <p><img src="https://i.stack.imgur.com/JIPdO.jpg" alt="enter image description here"></p>
  
  <p>In my Servlet I set: </p>
  
  <pre><code>&lt;%@ page contentType="text/html;charset=UTF-8" %&gt;
  </code></pre>
  
  <p>Here a a few example where I have get this erros from Chrome developer tools:</p>
  
  <p>Example 1: 
  <img src="https://i.stack.imgur.com/eATLl.jpg" alt="enter image description here"></p>
  
  <p>Example 2: 
  <img src="https://i.stack.imgur.com/qFe3p.jpg" alt="enter image description here">
  It helps a little but anyway sometimes I see the error. What do I have to do to fix this error?</p>
  
  <p>Example 3:
  <img src="https://i.stack.imgur.com/QaNOE.jpg" alt="enter image description here"></p>