Skip to content

Vite doesn't send cookie headers... what am I missing? #6455

Answered by rodrigocfd
rodrigocfd asked this question in Q&A
Discussion options

You must be logged in to vote

After trying many things, I found out that you need to set the entry from the root of the URL, so the cookies are saved with the correct path. In the example above, it would be:

proxy: {
    '/trunk': {
        target: 'http://localhost:8080',
        changeOrigin: true,
    },
},

And then the fetch would be:

fetch('/api/some/resource')

I believe this should be in the documentation.

I hope this works for you too, @monteki.

Replies: 7 comments 25 replies

Comment options

You must be logged in to vote
1 reply
@Jealh-h
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by rodrigocfd
Comment options

You must be logged in to vote
7 replies
@Its-Just-Nans
Comment options

@Calebsworld
Comment options

@Calebsworld
Comment options

@BrajBliss
Comment options

@ragnarbull
Comment options

Comment options

You must be logged in to vote
4 replies
@Calebsworld
Comment options

@Ksj14-kumar
Comment options

@dexbros
Comment options

@Ksj14-kumar
Comment options

Comment options

You must be logged in to vote
12 replies
@kiryls
Comment options

@Its-Just-Nans
Comment options

@kiryls
Comment options

@Its-Just-Nans
Comment options

@kiryls
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@karanshukla
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet