---
name: "X-Up-Origin-Mode"
area: "API"
kind: "HTTP header"
parent: "up.protocol module"
visibility: "experimental"
url: "https://unpoly.com/api/X-Up-Origin-Mode"
---
<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-Origin-Mode

**This feature is experimental**. Please [share](https://github.com/unpoly/unpoly/discussions) your experiences so we know what to keep or change.

This request header contains the [mode](https://unpoly.com/api/up.layer.mode.md) of the layer from which the interaction [originated](https://unpoly.com/api/origin.md).

Links or forms may target another layer than their own. The targeted layer is sent as an [`X-Up-Mode`](https://unpoly.com/api/X-Up-Mode.md) header.

## Example {#example}

Assume we have the following link in a modal overlay. The link targets the root layer:

```html
<!-- Link within an overlay -->
<a href="/" up-follow up-layer="root">Click me</a>
```

When the link is clicked, the following request headers are sent:

```http
X-Up-Mode: root
X-Up-Origin-Mode: modal
```

## Interaction origins {#interaction-origins}

The origin element is automatically set for many actions, for example:

| Action | Origin element |
| --- | --- |
| [Submitting a form](https://unpoly.com/learn/submitting-forms.md) with a submit button | The submit button |
| [Submitting a form](https://unpoly.com/learn/submitting-forms.md) by pressing `Return` | The focused field |
| [Following a link](https://unpoly.com/api/up-follow.md) | The link |
| [Preloading a link](https://unpoly.com/learn/preloading.md) | The link |
| [Validating a field](https://unpoly.com/api/up-validate.md) | The changed field |
| [Auto-submitting a field](https://unpoly.com/api/up-autosubmit.md) | The changed field |
| [Loading deferred content](https://unpoly.com/api/up-defer.md) | The [`[up-defer]`](https://unpoly.com/api/up-defer.md) placeholder |

When the origin element is unknown, this header is not sent.

