HX-Request
Indicates request was made by htmx
The HX-Request header indicates the request was made by htmx.
It’s value is always true.
Syntax
HX-Request: true
Use it to detect htmx requests on the server:
if request.headers.get('HX-Request'):
# This is an htmx request
return render_template('partial.html')
else:
# This is a regular browser request
return render_template('full.html')
Licensed under the Zero-Clause BSD License.
https://four.htmx.org/reference/headers/HX-Request/