Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
649ff9d3
Commit
649ff9d3
authored
Dec 12, 2014
by
usualdesigner
Committed by
Qiang Xue
Jan 15, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to set Access-Control-Expose-Headers in Cors filter
parent
f7cf3b50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
Cors.php
framework/filters/Cors.php
+7
-0
No files found.
framework/filters/Cors.php
View file @
649ff9d3
...
@@ -49,6 +49,8 @@ use yii\web\Response;
...
@@ -49,6 +49,8 @@ use yii\web\Response;
* 'Access-Control-Allow-Credentials' => true,
* 'Access-Control-Allow-Credentials' => true,
* // Allow OPTIONS caching
* // Allow OPTIONS caching
* 'Access-Control-Max-Age' => 3600,
* 'Access-Control-Max-Age' => 3600,
* // Allow the X-Pagination-Current-Page header to be exposed to the browser.
* 'Access-Control-Expose-Headers' => ['X-Pagination-Current-Page'],
* ],
* ],
*
*
* ],
* ],
...
@@ -82,6 +84,7 @@ class Cors extends ActionFilter
...
@@ -82,6 +84,7 @@ class Cors extends ActionFilter
'Access-Control-Request-Headers'
=>
[
'*'
],
'Access-Control-Request-Headers'
=>
[
'*'
],
'Access-Control-Allow-Credentials'
=>
null
,
'Access-Control-Allow-Credentials'
=>
null
,
'Access-Control-Max-Age'
=>
86400
,
'Access-Control-Max-Age'
=>
86400
,
'Access-Control-Expose-Headers'
=>
[],
];
];
...
@@ -169,6 +172,10 @@ class Cors extends ActionFilter
...
@@ -169,6 +172,10 @@ class Cors extends ActionFilter
$responseHeaders
[
'Access-Control-Max-Age'
]
=
$this
->
cors
[
'Access-Control-Max-Age'
];
$responseHeaders
[
'Access-Control-Max-Age'
]
=
$this
->
cors
[
'Access-Control-Max-Age'
];
}
}
if
(
isset
(
$this
->
cors
[
'Access-Control-Expose-Headers'
]))
{
$responseHeaders
[
'Access-Control-Expose-Headers'
]
=
implode
(
', '
,
$this
->
cors
[
'Access-Control-Expose-Headers'
]);
}
return
$responseHeaders
;
return
$responseHeaders
;
}
}
...
...
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