---
name: "X-Up-Dismiss-Layer"
area: "API"
kind: "HTTP header"
parent: "up.protocol module"
url: "https://unpoly.com/api/X-Up-Dismiss-Layer"
---
<nav aria-label="Unpoly docs">[All docs](https://unpoly.com/index.md) · [up.protocol module](https://unpoly.com/api/up.protocol.md)</nav>

# X-Up-Dismiss-Layer

The server may set this response header to [dismiss](https://unpoly.com/api/up.layer.dismiss.md) the targeted overlay in response to a fragment update.

Upon seeing the header, Unpoly will cancel the fragment update and dismiss the layer instead.

The header value is the dismissal value serialized as a [relaxed JSON](https://unpoly.com/api/relaxed-json.md) value. To dismiss an overlay without value, set the header value to the string `null`.

> #### Important
>
> HTTP headers [may only contain US-ASCII (7-bit) characters](https://www.rfc-editor.org/rfc/rfc7230#section-3.2.4). If you have higher code points in a JSON value, you may [encode those characters using Unicode escape sequences](https://makandracards.com/makandra/536174-http-headers-can-only-transport-us-ascii-characters-safely).

## Example {#example}

The response below will dismiss the targeted overlay without a dismissal value:

```http
HTTP/1.1 200 OK
Content-Type: text/html
X-Up-Dismiss-Layer: null

<html>
  ...
</html>
```

## Rendering content {#rendering-content}

The response may contain `text/html` content. If the root layer is targeted, the `X-Up-Dismiss-Layer` header is ignored and the fragment is updated with the response's HTML content.

If you know that an overlay will be closed and don't want to render HTML, have the server change the render target to [`:none`](https://unpoly.com/api/none.md):

```http
HTTP/1.1 200 OK
Content-Type: text/html
X-Up-Dismiss-Layer: { user_id: 1012 }
X-Up-Target: :none
```

