Skip to content

I don't know how to send header again as part of redirect handling #3214

Answered by Telroshan
milanaleksic asked this question in Q&A
Discussion options

You must be logged in to vote

there is an explicit design choice here

Not really! At least, not our choice ; the browser simply doesn't let us know about this standard redirection happening, so just as you don't receive a htmx:configRequest event for the "new" request, htmx itself cannot either catch it. The browser will follow the redirection and eventually pass its response to htmx, which won't even know about the first response that was redirected.
So, to answer your question in that part, htmx doesn't add its hx-* headers to the redirected request, the browser is doing that automatically.

As for your issue itself, I just tried with a local setup, if I set a custom header in a htmx:configRequest event listener, t…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@Telroshan
Comment options

Answer selected by milanaleksic
@milanaleksic
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants