File tree Expand file tree Collapse file tree 3 files changed +11
-6
lines changed
src/BenchmarksApps/TLS/HttpSys Expand file tree Collapse file tree 3 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -22,12 +22,13 @@ jobs:
22
22
mTLS : false # enables settings on http.sys to negotiate client cert on connections
23
23
tlsRenegotiation : false # enables client cert validation
24
24
certPublicKeyLength : 2048
25
+ httpSysUrlPrefix : " " # enables host header validation on http.sys layer
25
26
# debug settings
26
27
certValidationConsoleEnabled : false
27
28
httpSysLogs : false
28
29
statsEnabled : false
29
30
logRequestDetails : false
30
- arguments : " --urls https://{{serverAddress}}:{{serverPort}} --mTLS {{mTLS}} --certValidationConsoleEnabled {{certValidationConsoleEnabled}} --statsEnabled {{statsEnabled}} --tlsRenegotiation {{tlsRenegotiation}} --httpSysLogs {{httpSysLogs}} --logRequestDetails {{logRequestDetails}}"
31
+ arguments : " --urls https://{{serverAddress}}:{{serverPort}} --mTLS {{mTLS}} --certValidationConsoleEnabled {{certValidationConsoleEnabled}} --statsEnabled {{statsEnabled}} --tlsRenegotiation {{tlsRenegotiation}} --httpSysLogs {{httpSysLogs}} --logRequestDetails {{logRequestDetails}} --httpSysUrlPrefix {{httpSysUrlPrefix}} "
31
32
32
33
kestrelServer :
33
34
source :
@@ -77,6 +78,8 @@ scenarios:
77
78
httpsys-hostheader-mismatch :
78
79
application :
79
80
job : httpSysServer
81
+ variables :
82
+ httpSysUrlPrefix : " https://testserver.local:5000"
80
83
load :
81
84
job : httpclient
82
85
variables :
Original file line number Diff line number Diff line change 12
12
var tlsRenegotiationEnabled = bool . TryParse ( builder . Configuration [ "tlsRenegotiation" ] , out var tlsRenegotiationEnabledConfig ) && tlsRenegotiationEnabledConfig ;
13
13
var certPublicKeySpecified = int . TryParse ( builder . Configuration [ "certPublicKeyLength" ] , out var certPublicKeyConfig ) ;
14
14
var certPublicKeyLength = certPublicKeySpecified ? certPublicKeyConfig : 2048 ;
15
+ var urlPrefix = builder . Configuration [ "httpSysUrlPrefix" ] ;
15
16
16
17
// endpoints
17
18
var listeningEndpoints = builder . Configuration [ "urls" ] ?? "https://localhost:5000/" ;
38
39
// meaning client can send a certificate, but it can be explicitly requested by server as well (renegotiation)
39
40
options . ClientCertificateMethod = ClientCertificateMethod . AllowRenegotation ;
40
41
41
- foreach ( var listeningEndpoint in listeningEndpoints . Split ( ";" ) )
42
+ if ( ! string . IsNullOrEmpty ( urlPrefix ) )
42
43
{
43
- options . UrlPrefixes . Add ( listeningEndpoints ) ;
44
- Console . WriteLine ( "Added allowed url-prefix: " + listeningEndpoint ) ;
44
+ // Specific "hostname" to listen on.
45
+ // This turns on host validation on http.sys layer
46
+ options . UrlPrefixes . Add ( urlPrefix ) ;
47
+ Console . WriteLine ( "Set specific url-prefix for Http.Sys: " + urlPrefix ) ;
45
48
}
46
49
} ) ;
47
50
#pragma warning restore CA1416 // Can be launched only on Windows (HttpSys)
Original file line number Diff line number Diff line change 4
4
"Default" : " Information" ,
5
5
"Microsoft.AspNetCore" : " Warning"
6
6
}
7
- },
8
- "AllowedHosts" : " *"
7
+ }
9
8
}
You can’t perform that action at this time.
0 commit comments