Remove Server from HTTP Response in WCF

前端 未结 6 1102
北海茫月
北海茫月 2021-01-13 18:15

I have an internet exposed WCF service running on IIS 7.5 that I need to secure. I would like to remove the \"Server\" header in the HTTP response.

I\'ve implemented

6条回答
  •  独厮守ぢ
    2021-01-13 18:55

    For my self-hosted WCF service the answer from M Afifi does not work. I have to set an empty header:

    httpCtx.OutgoingResponse.Headers.Add(HttpResponseHeader.Server.ToString(), string.Empty);
    

    This removes the header from the response:

    access-control-allow-headers →Content-Type, Authorization, Accept
    access-control-allow-methods →GET, POST
    access-control-allow-origin →*
    content-type →application/json; charset=utf-8
    date →Mon, 03 Jul 2017 07:22:17 GMT
    status →200
    

提交回复
热议问题