How to prevent Host header attacks in springboot

1.5k Views Asked by At

I was reading in this article about Host header attacks https://crashtest-security.com/invalid-host-header/

and there are many solutions posted regards how to prevent Host header attacks like

X-Forwarded-Host
X-Host
X-Forwarded-Server

, but i am wondering if one of the solution is available in springboot-security?

Possible solutions:

1- Use relative URLs as much as possible.
2- Validate Host headers
3- Whitelist trusted domains
4 - Implement domain mapping
5 -Reject override headers
6 - Avoid using internal-only websites under a virtual host

How can one of them be implemented in springboot?

0

There are 0 best solutions below