Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
m
Affluence
Affluence Serv
Commits
3fc52b65
Commit
3fc52b65
authored
Mar 24, 2022
by
Sidson
Browse files
update: cors origin
parent
157a8996
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/app/cors.middleware.ts
View file @
3fc52b65
...
...
@@ -8,13 +8,7 @@ import { config, Middleware, MiddlewareInterface } from '@m-backend/core';
export
default
class
CorsMiddleware
implements
MiddlewareInterface
{
async
use
(
ctx
:
Context
,
next
:
Next
)
{
return
await
cors
({
origin
:
(
ctx
)
=>
{
let
origin
=
ctx
.
header
.
origin
;
if
(
config
.
app
.
externalUrl
.
indexOf
(
origin
)
!==
-
1
)
{
return
origin
;
}
return
false
;
},
origin
:
config
.
app
.
externalUrl
,
allowMethods
:
'
GET,HEAD,PUT,POST,DELETE
'
})(
ctx
,
next
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment