question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to not send cookie header

See original GitHub issue

Environment

  • Operating System: Linux
  • Node Version: v16.16.0
  • Nuxt Version: 3.0.0-rc.10
  • Nitro Version: 0.5.4
  • Package Manager: npm@8.11.0
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

Describe the bug

I have a backend on django(the same domain but it has /api prefix) and client app on nuxt 3 I need ssr and I run pm2 for client app (just for the sake of ssr and dynamic content) currently when I make request to my backend it sends all cookies I use. (I use cookies with persistedstate) it attaches everything. if I set ssr:false it is not sending cookie header

  1. how to prevent sending cookies in request headers ?
  2. if I use baseUrl and set different domain for that, it doesnt send cookies
  3. I have problems on backend regarding to this as well. I shouldnt send cookies.
  4. I dont need servers/api servers/middleware at all. I also get warnings regarding it cant find a route I spent a lot of time to find out the solution for this problem but I couldnt find. please help

Additional context

No response

Logs

No response

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
sevillaarvincommented, Sep 20, 2022

Have you tried adding { credentials: "omit" } to useFetch options?

3reactions
danielroecommented, Sep 20, 2022

Have you accidentally added it to your headers? You should do it like:

await $fetch('/api/test', {
  credentials: 'omit'
})
Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to prevent cookies to be sent in every HTTP ...
So if you make a first request that return cookies, you need to explicit read them, hold them locally somewhere, and eventually put...
Read more >
How do you prevent sending cookie data over HTTP the first ...
Set up your site to redirect from HTTP to HTTPS, and start sending Strict-Transport-Security headers. (You don't have to go for preload ...
Read more >
Using HTTP cookies - MDN Web Docs
After receiving an HTTP request, a server can send one or more Set-Cookie headers with the response. The browser usually stores the cookie...
Read more >
7 Keys to the Mystery of a Missing Cookie - Medium
Check out the OPTIONS response header ACCESS-CONTROL-ALLOW-CREDENTIAL whether it is set to true . If the server doesn't allow credentials being ...
Read more >
Using cookies - Postman Learning Center
You can't override cookie headers directly in the Headers tab. Edit the cookie in the cookie manager, or delete the cookie and set...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found