Does Nordcraft block the Cookie header?

  • henk_08753-1373286112688214097

    Henk_BLUE

    11 hours ago

    My backend sets http-only cookies via a Set-Cookie header. These are saved correctly in the browser as long as I do not use proxied API requests (which I don't intend). But when I execute API calls from Nordcraft, the Cookie header is not included.

    Are credentials not included in HTTP request in Nordcraft by default? Can we include them?
    1373287526705401916-screenXano.png
    1373287525980049478-screenNordcraft.png
  • andreasmoller-1373289204477595700

    Andreas Møller

    11 hours ago

    What is the cross-site value set to?
  • henk_08753-1373293274437255230

    Henk_BLUE

    10 hours ago

    for the cookie: user-session=thisIsATestButWouldBeASessionToken Domain=.operative.pro; Path=/; Secure; HttpOnly; SameSite=None
  • Tod-1373293277784178758

    Tod

    10 hours ago

    Great job @Henk_BLUE! Your contribution to the Nordcraft Community just made you advance to Community Level 2! 🌲
  • andreasmoller-1373293674464809050

    Andreas Møller

    10 hours ago

    It should probably not use a cookie for AUTH that has same site none
  • henk_08753-1373294599300448327

    Henk_BLUE

    10 hours ago

    I've set it to none as lax and strict where neither working. I tried to add a 'Cookie' header to the API request in the nordcraft editor, but it is not part of the request at all. Can you confirm if requests from Nordcraft include credentials: 'include'? Or should I look for a solution in how SameSite or CORS is configured on my end?
  • andreasmoller-1373294816754008134

    Andreas Møller

    10 hours ago

    It should not send them on lax or strict so that is fine.
  • andreasmoller-1373295089777901668

    Andreas Møller

    10 hours ago

    is the API you are calling proxied?
  • henk_08753-1373296623047807116

    Henk_BLUE

    10 hours ago

    Not through Nordcraft, no.. Is that a necessity? Because I prefer not to.
  • henk_08753-1373299831023599666

    Henk_BLUE

    10 hours ago

    For some context: I am setting up Cloudflare as a reverse proxy to prevent our database from being exposed and to enable us to make the same endpoints publicly available for developers that want to connect with our system, while we use the same endpoints on our front-end. And proxy chaining visitors trough the NC proxy and then through our own proxy is an invite to latency and inefficiency. So we are bound to set up custom authentication flow, as I understand it, which is where i am at now.
  • andreasmoller-1373303518110159008

    Andreas Møller

    10 hours ago

    No sending them through Nordcraft would not work
  • Can you check the dev tools and see if the cookie is being sent?
  • henk_08753-1373331631628353737

    Henk_BLUE

    8 hours ago

    Maybe this sheds some light on the case. There is no SSR or proxy enabled, the Nordcraft extension is also disabled. When I receive a response from the backend with a Set-Cookie header, these cookies are not saved. (only when I directly visit the API URL). But even when the cookie is set in the browser that way, it is not included in other requests to the backend because the Cookie header seems to be omitted. That is why i think "credentials: include" is not configured.

    But if I fetch with this action, the cookie is set as expected (but again, not sent for Nordcraft initiated API requests):
    /**
    * @param {Args} args
    * @param {Ctx} ctx
    */
    function callFetch(args, ctx) {
    fetch('https://cookiecall/getcookie', {
    method: 'GET',
    credentials: 'include', // Required for cookie to be stored
    })
    .then(res => res.json())
    .then(data => {
    console.log('Response:', data);
    })
    .catch(err => {
    console.error('Fetch error:', err);
    });
    }
  • henk_08753-1373335080604532736

    Henk_BLUE

    8 hours ago

    <there was a video, but I am not confortable leaving it up>