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) {
registry
.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(),
HttpMethod.DELETE.name(), HttpMethod.HEAD.name(), HttpMethod.OPTIONS.name(),
HttpMethod.PATCH.name())
@ -35,6 +35,7 @@ public class WebConfiguration implements WebMvcConfigurer {
.maxAge(1800); // Pre-flight Caching
}
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
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 {
System.out.println("@@@@@");
log.info("@@@@@@@@@@@@@@@@");
userService.join(user);
return ResponseEntity.ok("User registered successfully");
}

View File

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