Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gdtel-gztel-school-center
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
吴学德
gdtel-gztel-school-center
Commits
8e6c7253
Commit
8e6c7253
authored
Jun 24, 2021
by
邝钲钞
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改Shrio默认key,@RequestMapping访问方式限制为GET和POST
parent
15daeeb0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
gateway/src/main/java/com/winsun/framework/zuul/ZuulServiceApplication.java
+5
-5
No files found.
gateway/src/main/java/com/winsun/framework/zuul/ZuulServiceApplication.java
View file @
8e6c7253
...
...
@@ -21,17 +21,17 @@ public class ZuulServiceApplication {
final
UrlBasedCorsConfigurationSource
source
=
new
UrlBasedCorsConfigurationSource
();
final
CorsConfiguration
config
=
new
CorsConfiguration
();
config
.
setAllowCredentials
(
true
);
// 允许cookies跨域
//config.addAllowedOrigin("*");// 允许向该服务器提交请求的URI,*表示全部允许。。这里尽量限制来源域,比如http://xxxx:8080 ,以降低安全风险。。
//
config.addAllowedOrigin("*");// 允许向该服务器提交请求的URI,*表示全部允许。。这里尽量限制来源域,比如http://xxxx:8080 ,以降低安全风险。。
config
.
addAllowedOrigin
(
"https://dx.dianyuanjiangli.com"
);
// 允许向该服务器提交请求的URI,*表示全部允许。。这里尽量限制来源域,比如http://xxxx:8080 ,以降低安全风险。。
config
.
addAllowedHeader
(
"*"
);
// 允许访问的头信息,*表示全部
config
.
setMaxAge
(
18000L
);
// 预检请求的缓存时间(秒),即在这个时间段里,对于相同的跨域请求不会再预检了
config
.
addAllowedMethod
(
"*"
);
// 允许提交请求的方法,*表示全部允许,也可以单独设置GET、PUT等
c
onfig
.
addAllowedMethod
(
"HEAD"
);
//c
onfig.addAllowedMethod("HEAD");
config
.
addAllowedMethod
(
"GET"
);
// 允许Get的请求方法
config
.
addAllowedMethod
(
"PUT"
);
//
config.addAllowedMethod("PUT");
config
.
addAllowedMethod
(
"POST"
);
config
.
addAllowedMethod
(
"DELETE"
);
config
.
addAllowedMethod
(
"PATCH"
);
//
config.addAllowedMethod("DELETE");
//
config.addAllowedMethod("PATCH");
source
.
registerCorsConfiguration
(
"/**"
,
config
);
return
new
CorsFilter
(
source
);
}
...
...
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