2013-04-15 49 views

回答

1

您可以編輯_ _ init _ _ .py將SERVER_SOFTWARE設置爲任何你想要的。但是我真的很喜歡用標誌禁用這個功能,所以我升級時不需要重新應用這個補丁。

12

要更改「服務器:」 HTTP頭,在你的conf.py文件:

import gunicorn 
gunicorn.SERVER_SOFTWARE = 'Microsoft-IIS/6.0' 

,並使用調用一起的gunicorn -c conf.py wsgi:app

線要完全消除頭,你可以猴子-patch gunicorn通過用一個過濾出頭的子類替換它的http響應類。這可能是無害的,但可能不推薦。把下面的conf.py:

from gunicorn.http import wsgi 

class Response(wsgi.Response): 
    def default_headers(self, *args, **kwargs): 
     headers = super(Response, self).default_headers(*args, **kwargs) 
     return [h for h in headers if not h.startswith('Server:')] 

wsgi.Response = Response 

測試與gunicorn 18

相關問題