No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    ssrContext and cookies set from server side

    Help
    1
    1
    500
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • B
      bago last edited by

      Hello everybody,

      I’ve been working on my app and I have a question about the ssrContext in quasar.

      The context:

      I’m using Quasar SSR (isomorphic mode) to communicate with a BFF build on my own.
      After login (by using a fetch request with credential=include, mode=cors), my BFF set cross site server side cookies (with httpOnly=true, secure=true and SameSite=None).

      The problem:

      When I use the client side (created or mounted), everything work fine,
      I receive the cookies back from the server and they got store so that cookies are include in the next request to the server.

      But when I’m using the server side (preFetch), according to this

      There is a good reason for this. In a client-only app, every user will be using a fresh instance of the app in their browser. For server-side rendering we want the same thing. Each request should have a fresh, isolated app instance so that there is no cross-request state pollution
      

      So what I understand is that I’m on a fresh instance, so probably a fresh request as well
      (which means a different one from the client side).
      Thus, when I send a request from the ssrContex (preFetch), since it’s a fresh instance, my BFF must also set cookie for the ssrContext right ?

      Well, although I send a request from the ssrContext (via ssrContext.req), it looks like no cookie get set in ssrContext.res, causing my next request to be sent without any cookie.
      Is that an excepted behavior ? If yes why can’t we set cookies when a request is sent from ssrContext ?

      Regards,

      1 Reply Last reply Reply Quote 0
      • First post
        Last post