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

Content-Type header is lost when using the built in HTTP Basic Auth #38603

Closed
desjob opened this issue Oct 16, 2020 · 2 comments
Closed

Content-Type header is lost when using the built in HTTP Basic Auth #38603

desjob opened this issue Oct 16, 2020 · 2 comments

Comments

@desjob
Copy link

desjob commented Oct 16, 2020

Symfony version(s) affected: 4.4.x

Description
Content-Type header is lost when using the built in HTTP Basic Auth.
After the initial redirect response is followed, $request->getContentType() returns null.
Also, when inspecting the $_SERVER superglobal, the 'Content-Type' is no longer there.

When inspecting $_SERVER at the intial request (the one returning the redirect as part of the basic auth), the Content-Type is still there.

How to reproduce

  1. use a default basic auth setup from https://symfony.com/doc/4.4/security/auth_providers.html#security-http-basic
  2. create a Controller that is behind the basic auth firewall and:
    /**
     * @Route("/testapi", methods={Request::METHOD_GET})
     */
    public function getAllAction(string $resourceType, Request $request): Response
    {
        var_dump($request->getContentType());
        var_dump($_SERVER);
        die;
    }
  1. use Postman to call /testapi

Possible Solution
no suggestions, as i'm not sure where this is going wrong.

Additional context
I'm using postman to call my endpoint and set the request header, and i was considering the option that postman could be the issue here. However, when using the Postman Console it shows me the 2 separate requests as part of the basic auth, and the second request still has the Content-Type header that I filled in. Also, if I add any other custom header (i.e. X-FOOBAR), it IS available when i dump it from my controller after logging in, so the exception seems to be specifically on the Content-Type header.

@xabbuh
Copy link
Member

xabbuh commented Oct 19, 2020

Can you create a small example application that allows to reproduce your issue?

@xabbuh
Copy link
Member

xabbuh commented Oct 28, 2020

I am going to close here for now due to the lack of feedback. Please let us know when you have more information and we can consider to reopen.

@xabbuh xabbuh closed this as completed Oct 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants