HTTP Hosting Configuration
Configure the hosting settings of the PowerTSM HTTP API.
Configuration Path
Section titled “Configuration Path”HAKOM:TSM:Http:HostingConfiguration Structure
Section titled “Configuration Structure”Hosting├─ Urls├─ DefaultAcceptHeader├─ Cors│ ├─ Urls│ ├─ Methods│ ├─ Headers│ ├─ ExposedHeaders│ └─ Credentials├─ Compression│ ├─ EnableRequestDecompression│ └─ EnableResponseCompression├─ Endpoints│ └─ {EndpointName}│ ├─ Url│ ├─ Certificate│ │ └─ … (Kestrel certificate options)│ └─ … (other Kestrel endpoint options)├─ Limits│ └─ … (Kestrel limits options)└─ ProxySettings └─ ForwardedHeadersOptions ├─ ForwardedHeaders ├─ AllowedHosts ├─ ForwardLimit ├─ ForwardedForHeaderName ├─ ForwardedProtoHeaderName ├─ ForwardedHostHeaderName ├─ KnownProxies ├─ KnownNetwork ├─ ForwardedPrefixHeaderName └─ RequireHeaderSymmetryQuick Start
Section titled “Quick Start”Listen on two URLs:
<HAKOM> <TSM> <Http> <Hosting> <Urls>http://localhost:5000,https://localhost:5001</Urls> </Hosting> </Http> </TSM></HAKOM>Configuration Elements
Section titled “Configuration Elements”| Element | Type | Default | Required | Description |
|---|---|---|---|---|
Urls |
string |
http://localhost:5000 |
Comma-separated list of the URLs the service listens on. See Urls. | |
DefaultAcceptHeader |
string |
application/json |
Media type applied to requests without an Accept header. See Default Accept Header. |
|
Cors |
object |
— | Cross-origin resource sharing settings. See CORS Configuration. | |
Compression |
object |
— | Request decompression and response compression settings. See Compression Configuration. | |
Endpoints |
object |
— | Named Kestrel endpoints with per-endpoint certificates and SNI. See HTTP Hosting Endpoints Configuration. | |
Limits |
object |
— | Kestrel server limits. See HTTP Hosting Limits Configuration. | |
ProxySettings |
object |
— | Forwarded headers settings for running behind a reverse proxy. |
Urls is a comma-separated list of the URLs the service should listen on. The value is a single string in configuration, split on , into a list internally.
<Hosting> <Urls>http://localhost:5000,https://localhost:5001</Urls></Hosting>The default value, used when neither Urls nor Endpoints is configured, is a single http://localhost:5000.
For CORS configuration, see CORS Configuration.
Default Accept Header
Section titled “Default Accept Header”Clients are expected to send an Accept header stating which media type they want the response in (e.g. application/json). By design, a request that arrives with no Accept header at all is rejected with 406 Not Acceptable, the service doesn’t know what format to answer with.
This becomes a problem for clients that are simply unable to set an Accept header, such as health probes used by load balancers (e.g. Azure Front Door). DefaultAcceptHeader configures a media type that’s substituted in whenever a request arrives with a missing, empty, or whitespace-only Accept header, so those clients get a normal response instead of a 406.
<Hosting> <DefaultAcceptHeader>application/json</DefaultAcceptHeader></Hosting>The default value, used when DefaultAcceptHeader isn’t configured at all, is application/json.