How to silence "Invalid HTTP_HOST header" error?

Regarding the filter, see Filter objects.

You would create a Filter class with a filter method. The filter method can look for that specific string and return 0. (Note that you’re dealing with a LogRecord object and not just the text of the message.)

You would then put that filter in a named entry in the filter section of your logging configuration, and identify that named entry in the filters setting of your handler(s).
That way, if you wanted to track these, you could segregate them out to a different handler.

Regarding the name, I really don’t think anything in that area has anything to do with this.
This header is originally set by the client.
That means that either something (someone) is trying to access your server using a bot/client that is setting the HTTP_HOST value to that specific value, or you have something in between the client and your applications changing the value of that header.

I would check the configuration of the proxy (unless you’re using nginx as the proxy and you’ve already provided that information).

But beyond that, the only way I know of to track something like this down is to trap and trace requests to see at what point the header is being changed. I’d also look for additional information such as the IP address of the originator to try and determine the source - you might want (or need) to go back into your nginx configuration to get more detailed logging for this in addition to enhanced logging within gunicorn.