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

Accept X-Method-Override header when doing POST -> GET path length fallback #3297

Open
netrounds-guillaume opened this issue Apr 24, 2023 · 8 comments · May be fixed by #3298
Open

Accept X-Method-Override header when doing POST -> GET path length fallback #3297

netrounds-guillaume opened this issue Apr 24, 2023 · 8 comments · May be fixed by #3298

Comments

@netrounds-guillaume
Copy link

🚀 Feature

(A clear and concise description of what the feature is.)

Some browsers rename the X-HTTP-Override-Method header to X-Override-Method which causes the POST -> GET path length fallback to not kick in.

Feature proposal:

  • Accept both X-Override-Method and X-HTTP-Override-Method headers

Potential solution:

  • First read the X-Override-Method header and then try X-HTTP-Override-Method if not set
@johanbrandhorst
Copy link
Collaborator

Hi, this seems reasonable, but could you expand a bit on the problem? What browsers? Why? Is there a spec somewhere for this behavior? Is it a bug in the browser?

@netrounds-guillaume
Copy link
Author

netrounds-guillaume commented Apr 24, 2023

Hi,

I don't really know the details and I can't find documentation confirming it but when I set the X-HTTP-Method-Override header in a request sent by Chrome it is received on the server side as X-Method-Override.

That's all I've got

@johanbrandhorst
Copy link
Collaborator

Hm, that sounds odd, could you share the code? If we're going to add this sort of workaround I just want to make sure it's appropriate. What's the behavior in Firefox? Safari? Edge?

@netrounds-guillaume
Copy link
Author

I've tried with Chrome, Safari and Postman and they all rename the X-HTTP-Method-Override header into X-Method-Override.

curl does not.

@johanbrandhorst
Copy link
Collaborator

I tested this in Firefox and Chrome and just judging by the network tab it didn't exhibit the header rewrite. Could you maybe share a JS snippet that reproduces this?

@netrounds-guillaume
Copy link
Author

Yea, in the network tab we see the header as is but we receive it renamed on the server side.

I am quite confused as well and I can't find any documentation on this matter 🤷

Could you maybe share a JS snippet that reproduces this?

We use https://openapi-generator.tech/docs/generators/typescript-rxjs to generate a client from openapi specs

But even so, X-Method-Override seems to be widely used as well (regardless of the issue mentioned here)

@johanbrandhorst
Copy link
Collaborator

I'm not trying to be difficult here, just making sure we're making the right decision for the project, I'm sure you can understand 😁. Could you share some references for the use of the X-Method-Override in other software/proxies/clients?

@netrounds-guillaume
Copy link
Author

I know this is an old one but I found a bug around the same code: #3688

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 a pull request may close this issue.

2 participants