Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
monorepo
/
venus
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
1
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e0eb57d3
authored
Feb 17, 2025
by
Netfan
Committed by
GitHub
Feb 17, 2025
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
fix: nitro server cors support with cookie (#5549)
* 修复nitro server在使用cookie时的跨域配置
1 parent
b6b97acc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletions
apps/backend-mock/middleware/1.api.ts
apps/backend-mock/nitro.config.ts
apps/backend-mock/middleware/1.api.ts
View file @
e0eb57d
export
default
defineEventHandler
((
event
)
=>
{
export
default
defineEventHandler
((
event
)
=>
{
event
.
node
.
res
.
setHeader
(
'Access-Control-Allow-Origin'
,
event
.
headers
.
get
(
'Origin'
)
??
'*'
,
);
if
(
event
.
method
===
'OPTIONS'
)
{
if
(
event
.
method
===
'OPTIONS'
)
{
event
.
node
.
res
.
statusCode
=
204
;
event
.
node
.
res
.
statusCode
=
204
;
event
.
node
.
res
.
statusMessage
=
'No Content.'
;
event
.
node
.
res
.
statusMessage
=
'No Content.'
;
...
...
apps/backend-mock/nitro.config.ts
View file @
e0eb57d
...
@@ -9,7 +9,8 @@ export default defineNitroConfig({
...
@@ -9,7 +9,8 @@ export default defineNitroConfig({
cors
:
true
,
cors
:
true
,
headers
:
{
headers
:
{
'Access-Control-Allow-Credentials'
:
'true'
,
'Access-Control-Allow-Credentials'
:
'true'
,
'Access-Control-Allow-Headers'
:
'*'
,
'Access-Control-Allow-Headers'
:
'Accept, Authorization, Content-Length, Content-Type, If-Match, If-Modified-Since, If-None-Match, If-Unmodified-Since, X-CSRF-TOKEN, X-Requested-With'
,
'Access-Control-Allow-Methods'
:
'GET,HEAD,PUT,PATCH,POST,DELETE'
,
'Access-Control-Allow-Methods'
:
'GET,HEAD,PUT,PATCH,POST,DELETE'
,
'Access-Control-Allow-Origin'
:
'*'
,
'Access-Control-Allow-Origin'
:
'*'
,
'Access-Control-Expose-Headers'
:
'*'
,
'Access-Control-Expose-Headers'
:
'*'
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment