| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3d5c952 commit fe2713e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ | |||
| 8 | 8 | <version>0.0.1-SNAPSHOT</version> | |
| 9 | 9 | <packaging>jar</packaging> | |
| 10 | 10 | ||
| 11 | - <name>APIJSON(Idea)</name> | ||
| 11 | + <name>APIJSON</name> | ||
| 12 | 12 | <description>APIJSON Server project using Spring Boot</description> | |
| 13 | 13 | ||
| 14 | 14 | <parent> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,17 +57,18 @@ public static void main(String[] args) throws Exception { | |||
| 57 | 57 | @Bean | |
| 58 | 58 | public CorsFilter corsFilter() { | |
| 59 | 59 | UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | |
| 60 | - source.registerCorsConfiguration("/**", buildConfig()); // 4 | ||
| 60 | + source.registerCorsConfiguration("/**", buildConfig()); | ||
| 61 | 61 | return new CorsFilter(source); | |
| 62 | 62 | } | |
| 63 | 63 | /**CORS跨域配置 | |
| 64 | 64 | * @return | |
| 65 | 65 | */ | |
| 66 | 66 | private CorsConfiguration buildConfig() { | |
| 67 | 67 | CorsConfiguration corsConfiguration = new CorsConfiguration(); | |
| 68 | - corsConfiguration.addAllowedOrigin("*"); | ||
| 69 | - corsConfiguration.addAllowedHeader("*"); | ||
| 70 | - corsConfiguration.addAllowedMethod("*"); | ||
| 68 | + corsConfiguration.addAllowedOrigin("*"); //允许的域名或IP地址 | ||
| 69 | + corsConfiguration.addAllowedHeader("*"); //允许的请求头 | ||
| 70 | + corsConfiguration.addAllowedMethod("*"); //允许的HTTP请求方法 | ||
| 71 | + corsConfiguration.setAllowCredentials(true); //允许发送跨域凭据,前端Axios存取JSESSIONID必须要 | ||
| 71 | 72 | return corsConfiguration; | |
| 72 | 73 | } | |
| 73 | 74 | //支持JavaScript跨域请求 >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments