spring 3

[ERROR] javax.servlet.ServletRequest.getRemoteAddr() is not supported

[이슈 당시 상황] Back단 java application, Front단 react, nextjs를 사용해서 프로젝트를 진행 AWS EC2 인스턴스로 배포 하고, Route 53으로 DNS 연결을 하고 ACM 으로 SSL 연결 해당 EC2를 443 포트로 로드밸런싱을 처리 [이슈 내용] 특정 IP만 접속 가능하도록 설정 해두었는데, 해당 IP으로 접근이 되지 않고 javax.servlet.ServletRequest.getRemoteAddr() is not supported 에러가 발생. [해결 방안] 일반적으로 Spring Security의 인증 과정에서 HttpServletRequest를 사용하여 클라이언트의 IP 주소를 가져올 수 있습니다. 그러나 특정 환경에서는 getRemoteAddr() 메서드..

Java/Spring 2023.06.28

[스프링 웹 개발 기초]MVC와 템플릿 엔진

MVC: Model, View, Controller Controller @Controller public class HelloController { @GetMapping("hello-mvc") public String helloMvc(@RequestParam("name") String name, Model model) { model.addAttribute("name", name); return "hello-template"; } } View resources/template/hello-template.html hello! empty 실행 http://localhost:8080/hello-mvc?name=spring thymeleaf를 기능 서버 연결없이 html을 실행(절대경로로)하면 hello! emp..

Java/Spring 2021.03.24