How to restrict endpoint access to htmx only?

Hi all,

I have started experimenting with django and the other day i also started studing htmx. So i was wandering what is the best approach to allow access to a certain set of endpoints only to htmx?


You can’t. HTMX issues the same get and post requests as anything else does. (Technically, it’s just another JavaScript framework.)
HTMX does set a header to indicate that a request is being sent by HTMX, but any JavaScript code can set the same header.

1 Like