Custom headers on form requests #4397
Replies: 4 comments 6 replies
-
Is there no way to attach that headers somewhere else server-side but before it reaches Fly? Maybe on the CDN 🤔 |
Beta Was this translation helpful? Give feedback.
-
I also think having it available on the function ExampleForm() {
const submit = useSubmit();
return (
<Form
method="post"
onSubmit={e => {
e.preventDefault();
// The form work before JS and will be enhanced with extra header after hydation
submit(e.currentTarget, { headers: { 'fly-prefer-region': ENV.PRIMARY_REGION } })
}}
>
{ /* ... */}
</Form>
);
} |
Beta Was this translation helpful? Give feedback.
-
I am building an app that is designed to be embedded on 3rd party sites in an iframe. Supporting safari is a requirement for this app, and because of safari's bug (feature?) we are unable to use cookies from within an iframe on 3rd party sites without sandboxing and user prompts. https://stackoverflow.com/a/72506013 The way safari suggests doing it is non-standard and relies upon the storage access api. https://developer.mozilla.org/en-US/docs/Web/API/Storage_Access_API If someone knows of a good way to use cookies reliably for embedded sites across browsers I am eager to hear how it is done. Currently, I am monkey-patching the I appreciate the ideal of remix working without JS. But supporting something like a |
Beta Was this translation helpful? Give feedback.
-
Also headers as a replacement for cookies is going to become even more beneficial. safari is already killing 3rd party cookies, and soon chrome and firefox will too. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'd like to be able to specify custom headers on form requests because my infrastructure (Fly.io) can behave differently based on some headers and I'd like to take advantage of that.
Having something global would be cool, but I'm fine setting it on a per-form basis.
Also, I realize that there's no way to do this with regular HTML, so this would just be an enhancement not something that would work without JS.
Here's my idea:
Same for fetcher.Form
And for
useSubmit
andfetcher.load/submit
:Beta Was this translation helpful? Give feedback.
All reactions