I want to secure my spring boot app with XSS protection. I have Spring Boot application implemented with Spring Security.
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.
How can I implement basic XSS protection, filter that can remove all suspicious strings from incoming requests?
Edit:
I have found this article: https://www.baeldung.com/spring-prevent-xss. But this project uses ESAPI library wchich is pretty big and slowing down application, so I would like to find different, easier approach.