Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove the x-requested-with header from the tm-http-request message #8148

Closed
wants to merge 1 commit into from

Conversation

mklauber
Copy link
Contributor

Extraneous headers can interfere with CORS validation when hitting external APIs, due to tightly configured Access-Control-Allow-Headers headers. Until there's a way to disable these headers, it's probably better (i.e. most flexible) to expect users to set them deliberately.

In this case, I ran into an API that uses CORS and the above header, and was unable to make a request to it without making the changes in this PR. I'm also open to modifying the message to allow disabling these headers, but this was the simplest solution I could come up with.

Extraneous headers can interfere with CORS validation when hitting external APIs, due to tightly configured `Access-Control-Allow-Headers` headers.  Until there's a way to disable these headers, it's probably better (i.e. most flexible) to expect users to set them deliberately.  

In this case, I ran into an API that uses cors and the above header, and was unable to make a request to it without making the changes in this PR.

I'm also open to modifying the message to allow disabling these headers, but this was the simplest solution I could come up with.
Copy link

vercel bot commented Apr 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
tiddlywiki5 ✅ Ready (Inspect) Visit Preview Apr 16, 2024 1:05pm

@mklauber mklauber changed the title Remove the x-requested-with header from the tm-http-request message Remove the x-requested-with header from the tm-http-request message Apr 16, 2024
@Jermolene
Copy link
Member

Hi @mklauber I think that is reasonable, however we would also need to adjust tiddlywebadaptor.js to manually set the x-requested-with header because it is required by the TiddlyWiki API.

I think that any existing user code hitting a TW-based API would fail with this change. Perhaps instead of removing the header we could add a flag for explicitly disabling it? Ideally, we'd also expose that flag to user code via the tm-http-request message.

@mklauber
Copy link
Contributor Author

I suggest setting a flag to only use explicit headers. I can try to write that, it may take me a few days.

@mklauber mklauber marked this pull request as draft April 16, 2024 14:57
@mklauber
Copy link
Contributor Author

replaced with #8152

@mklauber mklauber closed this Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants