feat: cors

This commit is contained in:
박정민 2024-07-31 15:11:49 +09:00
parent 176b1554e9
commit c854debbe7
3 changed files with 5 additions and 2 deletions

View File

@ -26,7 +26,7 @@ public class WebConfiguration implements WebMvcConfigurer {
public void addCorsMappings(CorsRegistry registry) { public void addCorsMappings(CorsRegistry registry) {
registry registry
.addMapping("/**") .addMapping("/**")
.allowedOrigins("https://i11a701.p.ssafy.io/", "http://localhost:5173", "http://localhost:4173","http://localhost:5080") .allowedOrigins("https://i11a701.p.ssafy.io/", "http://localhost:5173", "http://localhost:4173","http://localhost:5080","http://192.168.*:5173")
.allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(), .allowedMethods(HttpMethod.GET.name(), HttpMethod.POST.name(), HttpMethod.PUT.name(),
HttpMethod.DELETE.name(), HttpMethod.HEAD.name(), HttpMethod.OPTIONS.name(), HttpMethod.DELETE.name(), HttpMethod.HEAD.name(), HttpMethod.OPTIONS.name(),
HttpMethod.PATCH.name()) HttpMethod.PATCH.name())
@ -35,6 +35,7 @@ public class WebConfiguration implements WebMvcConfigurer {
.maxAge(1800); // Pre-flight Caching .maxAge(1800); // Pre-flight Caching
} }
@Override @Override
public void addResourceHandlers(ResourceHandlerRegistry registry) { public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/assets/img/"); registry.addResourceHandler("/img/**").addResourceLocations("classpath:/static/assets/img/");

View File

@ -35,6 +35,8 @@ public class UserController {
public ResponseEntity<String> join(@RequestBody User user) throws Exception { public ResponseEntity<String> join(@RequestBody User user) throws Exception {
System.out.println("@@@@@");
log.info("@@@@@@@@@@@@@@@@");
userService.join(user); userService.join(user);
return ResponseEntity.ok("User registered successfully"); return ResponseEntity.ok("User registered successfully");
} }

View File

@ -23,7 +23,7 @@ public class UserServiceImpl implements UserService {
private final UserRepository userRepository; private final UserRepository userRepository;
private final JavaMailSender mailSender; private final JavaMailSender mailSender;//private final PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
public void join(User user) public void join(User user)