title: Spring static content(css) not served properly (spring boot)
body: <p>I have a spring boot app and a controller that server static webpage(React build):</p>
  
  <pre><code>@Controller
  @RequestMapping("/test")
  public class HomeController {
  
      @GetMapping("/")
      public String index() {
      return "index.html";
  } 
   ...
  </code></pre>
  
  <p>index.html is located at:   ../resources/static/index.html</p>
  
  <p>also in application.yml:</p>
  
  <pre><code>spring:
    mvc:
      static-path-pattern: /test/**
  </code></pre>
  
  <p>I am having two problems(problem 2 is the main issue):</p>
  
  <ol>
  <li><p>I must call the following url with the trailing '/' at the end:  <a href="http://localhost:8100/test/" rel="nofollow noreferrer">http://localhost:8100/test/</a> I would like for <a href="http://localhost:8100/test" rel="nofollow noreferrer">http://localhost:8100/test</a> to also map me to the view(index.html).</p></li>
  <li><p>during the load of the page I am getting the following error:
  <a href="https://i.stack.imgur.com/d3RJO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/d3RJO.png" alt="Error"></a></p></li>
  </ol>
  
  <p>the problem as you can see is that the url called is: 
  <a href="http://localhost:8100/static/css/main.6c417d20.chunk.css" rel="nofollow noreferrer">http://localhost:8100/static/css/main.6c417d20.chunk.css</a></p>
  
  <p>and not</p>
  
  <p><a href="http://localhost:8100/test/static/css/main.6c417d20.chunk.css" rel="nofollow noreferrer">http://localhost:8100/test/static/css/main.6c417d20.chunk.css</a></p>
  
  <p>(please note that the reason for the 'static' in the url  is that there is a folder named: static below the resources/static folder so there is no issue with the 'static' in the url)</p>
  
  <p>is it a server side problem or is it something I should fix in the react?</p>
  
  <p>I searched for an answer but didn't find anything helpful.</p>
  
  <p>any help would be highly appreciated,
  Tnx</p>