I know I can add the IPs, which I want to serve in the server firewall and then use TrustedHostMiddleware , but I want to look if there are alternative approaches.
TrustedHostMiddleware