Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
ioc_sixiang_license
Project
Project
Details
Activity
Releases
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
zengtianlai3
ioc_sixiang_license
Commits
914a09b3
Commit
914a09b3
authored
Aug 05, 2022
by
zengtianlai3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改CORS跨域资源共享
parent
dce5bfa8
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
2 deletions
+13
-2
CorsConfig.java
.../src/main/java/iot/sixiang/license/config/CorsConfig.java
+9
-2
application.yml
license/src/main/resources/application.yml
+4
-0
No files found.
license/src/main/java/iot/sixiang/license/config/CorsConfig.java
View file @
914a09b3
...
...
@@ -3,6 +3,7 @@ package iot.sixiang.license.config;
import
iot.sixiang.license.jwt.AuthenticationInterceptor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.web.servlet.config.annotation.*
;
...
...
@@ -14,11 +15,17 @@ public class CorsConfig implements WebMvcConfigurer {
@Autowired
AuthenticationInterceptor
authenticationInterceptor
;
@Value
(
"${cros.cros_allowed_origins}"
)
private
String
[]
allowedOrigins
;
@Value
(
"${cros.cros_allowed_method}"
)
private
String
[]
allowedMethods
;
@Override
public
void
addCorsMappings
(
CorsRegistry
registry
)
{
registry
.
addMapping
(
"/**"
)
.
allowedOrigins
(
"*"
)
.
allowedMethods
(
"*"
)
.
allowedOrigins
(
allowedOrigins
)
.
allowedMethods
(
allowedMethods
)
.
allowCredentials
(
true
)
.
maxAge
(
3600
)
.
allowedHeaders
(
"*"
);
...
...
license/src/main/resources/application.yml
View file @
914a09b3
...
...
@@ -12,3 +12,7 @@ logging:
server
:
tomcat
:
port-header
:
HEAD,PUT,DELETE,OPTIONS,TRACE,COPY,SEARCH,PROPFIND
cros
:
cros_allowed_origins
:
http://192.168.1.88:8080, http://localhost:8868
cros_allowed_method
:
GET,POST
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