[Django]-Delete header in django rest framework response

3👍

I just had the exact same problem. Your approach with

del response['Server']

Is correct!

However, you need to move your middleware to be the first. As other middlewares will add headers after the response is constructed, so the order of application is bottom-up. Your middleware has to be the first one to have the “last word”.

Leave a comment