Unpoly has an optional protocol your backend may implement to inspect and manipulate Unpoly's rendering.
The protocol mostly works by reading or setting simple HTTP headers (like X-Up-Target).
It's quite straightforward to use in your own code, and you don't have to implement all of it.
You can also use existing implementations, which are available for most popular web frameworks.
Important
While the protocol can help you optimize performance and handle some edge cases, implementing it is entirely optional. For instance,
unpoly.comitself is a static site that uses Unpoly on the frontend and doesn't even have an active server component.
This response header contains a hash identifying the content in the response body.
This request header contains the last modification time of a fragment that is being reloaded.
This request header contains the ETag of a fragment that is being reloaded.
This response header contains the time when the content in the response body was last modified.
The server may set this optional cookie to echo the HTTP method of the initial request.
Configures strings used in the optional server protocol.
Request headers that influenced a response should be listed in a Vary response header.
The server may set this response header to accept the targeted overlay in response to a fragment update.
The server may send this optional response header to control which previously cached responses should be expired after this response.
This request header contains the targeted layer's context, serialized as JSON.
The server may set this response header to dismiss the targeted overlay in response to a fragment update.
The server may set this response header to emit events with the requested fragment update.
The server may send this optional response header to control which previously cached responses should be evicted after this response.
The server may send this optional response header to control which previously cached responses should be expired after this response.
This request header contains the context of the layer targeted for a failed fragment update, serialized as JSON.
This request header contains the mode of the layer targeted for a failed fragment update.
This request header contains the target selector for a failed fragment update.
The server may set this response header to set a custom browser location after a fragment update.
The server may set this optional response header to change the HTTP method after a fragment update.
This request header contains the targeted layer's mode.
The server can send this response header to force its response to open a new overlay.
This request header contains the mode of the layer from which the interaction originated.
This request header contains a timestamp of an existing fragment that is being reloaded.
The X-Up-Target request and response headers allow the server read or change
the target selector for a fragment update.
The server may set this optional response header to change the document title after a fragment update.
This request header contains the names of the form fields being validated.
This request header contains the current Unpoly version to mark this request as a fragment update.