#### [Abblix\.Oidc\.Server\.AspNetCore](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore 'index')
### [Abblix\.Oidc\.Server\.AspNetCore](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore/Abblix.Oidc.Server.AspNetCore 'Abblix\.Oidc\.Server\.AspNetCore')

## HttpResponseExtensions Class

Response\-shaping helpers shared by the MVC and Minimal API adapters\.

```csharp
public static class HttpResponseExtensions
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → HttpResponseExtensions
### Methods

## HttpResponseExtensions\.SetCacheableHeaders\(this HttpResponse, TimeSpan\) Method {#Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions.SetCacheableHeaders(thisMicrosoft.AspNetCore.Http.HttpResponse,System.TimeSpan)}

Advertises a positive cache lifetime for a public, cacheable metadata response \- the JWKS endpoint\. Sets
`Cache-Control: public, max-age=<maxAge>` and clears any `Pragma` / `Expires` a
no\-cache policy left behind, so the response carries a single, non\-contradictory caching directive\. Size
[maxAge](https://www.abblix.com/en/docs/api/abblix-oidc-server-aspnetcore/Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions#Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions.SetCacheableHeaders(thisMicrosoft.AspNetCore.Http.HttpResponse,System.TimeSpan).maxAge 'Abblix\.Oidc\.Server\.AspNetCore\.HttpResponseExtensions\.SetCacheableHeaders\(this Microsoft\.AspNetCore\.Http\.HttpResponse, System\.TimeSpan\)\.maxAge') to the key\-rollover propagation window, so a client honouring the header always
holds a new signing key's public half before the server produces tokens with it\.

```csharp
public static void SetCacheableHeaders(this Microsoft.AspNetCore.Http.HttpResponse response, System.TimeSpan maxAge);
```
#### Parameters

###### `response` [Microsoft\.AspNetCore\.Http\.HttpResponse](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httpresponse 'Microsoft\.AspNetCore\.Http\.HttpResponse') {#Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions.SetCacheableHeaders(thisMicrosoft.AspNetCore.Http.HttpResponse,System.TimeSpan).response}

The HTTP response to modify\.

###### `maxAge` [System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan') {#Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions.SetCacheableHeaders(thisMicrosoft.AspNetCore.Http.HttpResponse,System.TimeSpan).maxAge}

How long a shared or private cache may reuse the response\.

## HttpResponseExtensions\.SetNoCacheHeaders\(this HttpResponse\) Method {#Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions.SetNoCacheHeaders(thisMicrosoft.AspNetCore.Http.HttpResponse)}

Sets comprehensive no\-cache headers on the response to prevent caching\.
Ensures responses containing sensitive information \(tokens, credentials, logout pages\) are never cached\.

```csharp
public static void SetNoCacheHeaders(this Microsoft.AspNetCore.Http.HttpResponse response);
```
#### Parameters

###### `response` [Microsoft\.AspNetCore\.Http\.HttpResponse](https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.http.httpresponse 'Microsoft\.AspNetCore\.Http\.HttpResponse') {#Abblix.Oidc.Server.AspNetCore.HttpResponseExtensions.SetNoCacheHeaders(thisMicrosoft.AspNetCore.Http.HttpResponse).response}

The HTTP response to modify\.

### Remarks
Sets the following headers for maximum compatibility:
- <b>Cache-Control</b>: "no-store, no-cache, max-age=0, s-maxage=0"
              - Prevents storage in any cache (HTTP/1.1)
- <b>Pragma</b>: "no-cache" - Prevents caching in HTTP/1.0 proxies and legacy browsers
- <b>Expires</b>: Unix epoch - Sets expiration to the past for HTTP/1.0 compatibility
