title: How to prevent from Cross Site Scripting (XSS) attack in Spring Boot application?
body: <p>I want to secure my spring boot app with XSS protection. I have Spring Boot application implemented with Spring Security.</p>
  <p>Additionally I have second application (frontend) working on different port (different origin) - that is why I cannot set Content Security Policy as 'self' for preventing XSS attacks.</p>
  <p><strong>How can I implement basic XSS protection, filter that can remove all suspicious strings from incoming requests?</strong></p>
  <p><strong>Edit:</strong></p>
  <p>I have found this article: <a href="https://www.baeldung.com/spring-prevent-xss" rel="nofollow noreferrer">https://www.baeldung.com/spring-prevent-xss</a>. But this project uses ESAPI library wchich is pretty big and slowing down application, so I would like to find different, easier approach.</p>