title: Auto-redirect root path to Spring Boot Context Path
body: <p>I am using Spring Boot Context Path as specified in the application.properties file, and it works great</p>
  
  <pre><code>server.port=5000
  server.context-path=/services
  </code></pre>
  
  <p>Spring Boot 2.0 and above</p>
  
  <pre><code>server.port=5000
  server.servlet.context-path=/services
  </code></pre>
  
  <p>But how can we achieve default redirect of root i.e. “/” to “/services”</p>
  
  <p><a href="http://localhost:5000/services" rel="noreferrer">http://localhost:5000/services</a> - works great!</p>
  
  <p>But I want <a href="http://localhost:5000/" rel="noreferrer">http://localhost:5000/</a> to automatically redirect to -> <a href="http://localhost:5000/services" rel="noreferrer">http://localhost:5000/services</a> so that an end user should be able to access the root of the domain and be automatically redirected to the context path</p>
  
  <p>Currently accessing the root is throwing a 404 (which makes sense with the default configuration)</p>
  
  <p>How can I achieve the automatic redirect of root i.e. “/”  to the context path?</p>