Unpoly has an optional protocol your server may implement to exchange additional information
when Unpoly is updating fragments. The protocol mostly works by adding
additional HTTP headers (like X-Up-Target
) to requests and responses.
Important
While the protocol can help you optimize performance and handle some edge cases, implementing it is entirely optional. For instance,
unpoly.com
itself is a static site that uses Unpoly on the frontend and doesn't even have an active server component.
You should be able to implement the protocol in a very short time.
There are existing implementations for various web frameworks:
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.
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.