Skip to content

Commit

Permalink
optimize: AfterOPTIONSHeaders.js,多添加一个响应头 Cross-Origin-Resource-Policy
Browse files Browse the repository at this point in the history
  • Loading branch information
wangliang181230 committed Dec 5, 2024
1 parent cbc3f00 commit 6a20f0d
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ module.exports = {
responseIntercept (context, interceptOpt, req, res, proxyReq, proxyRes, ssl, next) {
const { rOptions, log } = context

if (rOptions.method === 'OPTIONS' || rOptions.headers.origin == null) {
if (rOptions.method === 'OPTIONS') {
return
}

const headers = {
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Origin': rOptions.headers.origin,
'Access-Control-Allow-Origin': '*',
'Cross-Origin-Resource-Policy': interceptOpt.optionsCrossPolicy || 'cross-origin',
}

res.setHeader('DS-AfterOPTIONSHeaders-Interceptor', '1')
Expand Down

0 comments on commit 6a20f0d

Please sign in to comment.