Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
OSmall
/
linjiashop
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
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 f786fa4d
authored
Dec 23, 2020
by
wnb0128
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
跨域问题处理--think.wang
1 parent
766f4da0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
3 deletions
shop-core/src/main/java/com/glsx/shop/web/filter/CorsFilter.java
shop-core/src/main/java/com/glsx/shop/web/filter/CorsFilter.java
View file @
f786fa4
...
...
@@ -29,13 +29,13 @@ public class CorsFilter implements Filter {
response
.
addHeader
(
HttpHeaders
.
ACCESS_CONTROL_ALLOW_METHODS
,
request
.
getMethod
());
response
.
addHeader
(
HttpHeaders
.
ACCESS_CONTROL_ALLOW_ORIGIN
,
request
.
getHeader
(
HttpHeaders
.
ORIGIN
));
StringBuffer
headerSb
=
new
StringBuffer
();
StringBuffer
buffer
=
new
StringBuffer
();
Enumeration
<
String
>
headerNames
=
request
.
getHeaderNames
();
while
(
headerNames
.
hasMoreElements
())
{
headerSb
.
append
(
headerNames
.
nextElement
()).
append
(
","
);
buffer
.
append
(
headerNames
.
nextElement
()).
append
(
","
);
}
response
.
addHeader
(
HttpHeaders
.
ACCESS_CONTROL_ALLOW_HEADERS
,
headerSb
.
toString
().
replaceAll
(
", *$"
,
""
));
buffer
.
toString
().
replaceAll
(
", *$"
,
""
));
response
.
addHeader
(
HttpHeaders
.
ACCESS_CONTROL_ALLOW_CREDENTIALS
,
"true"
);
response
.
addHeader
(
HttpHeaders
.
ACCESS_CONTROL_EXPOSE_HEADERS
,
"*"
);
response
.
addHeader
(
HttpHeaders
.
ACCESS_CONTROL_MAX_AGE
,
"18000L"
);
...
...
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