Skip to content

CORS support with CSRF #19349

Closed
Closed

Description

@jrhite

// Skip both non-mutating requests and absolute URLs.
// Non-mutating requests don't require a token, and absolute URLs require special handling
// anyway as the cookie set
// on our origin is not the same as the token expected by another origin.
if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') ||
lcUrl.startsWith('https://')) {
return next.handle(req);
}

Why isn't this configurable with .withOptions()?

I need to use CSRF with CORS and it seems like an oversight that this is not possible with HttpClientXsrfModule.

How should this be done, short of writing my own HttpClientXsrfModule?

I also asked the same question here on StackOverflow.

Thanks.

Activity

  1. jrhite commented on Sep 27, 2017

    @jrhite
    Author

    @alxhub any thoughts on this?

    thanks!

  2. added
    area: common/http
    on Sep 28, 2017
  3. sant0shg commented on Oct 3, 2017

    @sant0shg

    Similar to #18859

  4. alxhub commented on Nov 28, 2017

    @alxhub
    Member

    @jrhite you should write your own interceptor/module. The default module has no way of knowing the set of domains which will honor your same XSRF token.

  5. angular-automatic-lock-bot commented on Sep 12, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Sep 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: common/http

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions