title: HTTP 413 error when using spring boot with Angular 4
body: <p>My system consists of an angular application that communicates with a REST endpoint (POST) in a spring boot application. 
  Spring boot is configured to use jetty as the embedded server. The angular application has TypeScript code that calls the REST endpoint and sends a json object as payload. The size of the json object will vary from 1 MB to 10 MB based on user selection in the browser.
  My spring boot application runs in an Azure VM that runs Linux (CentOS).
  For certain requests i get the HTTP error 413: Request size is too large.
  I did some searches and found 2 mechanisms to tune the spring boot application to overcome this limit.</p>
  
  <p>Option 1
  Change the request size limit in application.properties using this property
  server.jetty.max-http-post-size=20971520 # Maximum size in bytes of the HTTP post or put content.</p>
  
  <p>Option 2
  Override the jetty maxFormContentSize using some java code in the main application class</p>
  
  <pre><code>@Bean
  public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {
      JettyEmbeddedServletContainerFactory jettyContainer =
              new JettyEmbeddedServletContainerFactory();
      org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer serverContainer = (org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainer)jettyContainer.getEmbeddedServletContainer();
      serverContainer.getServer().setAttribute("org.eclipse.jetty.server.Request.maxFormContentSize", "20971520");
      return jettyContainer;
  }
  </code></pre>
  
  <p>None of these options work and I still get the error when certain requests are large.</p>
  
  <p>Is there a better way to solve this problem? </p>
  
  <p>Note: I see this error only in the Azure VM environment that runs CentOS. In my machine which runs windows 10, I don't see this error</p>
  
  <p>Update: I noticed that when the web server is rebooted, the very first request goes through but subsequent requests fail. This suggests that there some buffer or cache at the server which is not getting cleared in time. Is my understanding correct?</p>