Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
edce9ec2
Commit
edce9ec2
authored
Jun 12, 2019
by
Junling Bu
Browse files
fix[litemall-core]: 可能解决跨域问题
parent
10a4d01d
Changes
1
Hide whitespace changes
Inline
Side-by-side
litemall-core/src/main/java/org/linlinjava/litemall/core/config/CorsConfig.java
View file @
edce9ec2
...
...
@@ -8,11 +8,14 @@ import org.springframework.web.filter.CorsFilter;
@Configuration
public
class
CorsConfig
{
// 当前跨域请求最大有效时长。这里默认30天
private
long
maxAge
=
30
*
24
*
60
*
60
;
private
CorsConfiguration
buildConfig
()
{
CorsConfiguration
corsConfiguration
=
new
CorsConfiguration
();
corsConfiguration
.
addAllowedOrigin
(
"*"
);
// 1 设置访问源地址
corsConfiguration
.
addAllowedHeader
(
"*"
);
// 2 设置访问源请求头
corsConfiguration
.
addAllowedMethod
(
"*"
);
// 3 设置访问源请求方法
corsConfiguration
.
setMaxAge
(
maxAge
);
return
corsConfiguration
;
}
...
...
Write
Preview
Supports
Markdown
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