From e91b0dd1c799ed4de4de58ae114c6ecf2d767699 Mon Sep 17 00:00:00 2001 From: Jiwon Date: Tue, 25 Jul 2023 13:31:02 +0900 Subject: [PATCH] =?UTF-8?q?[feat]=20host=EA=B2=BD=EB=A1=9C=20=ED=99=95?= =?UTF-8?q?=EC=9D=B8=20controller=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hooking/controller/CopyController.java | 2 +- .../hooking/controller/RefererController.java | 30 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 src/main/java/shop/hooking/hooking/controller/RefererController.java diff --git a/src/main/java/shop/hooking/hooking/controller/CopyController.java b/src/main/java/shop/hooking/hooking/controller/CopyController.java index 65d7b77..9b979f1 100644 --- a/src/main/java/shop/hooking/hooking/controller/CopyController.java +++ b/src/main/java/shop/hooking/hooking/controller/CopyController.java @@ -47,7 +47,7 @@ public class CopyController { // 전체 카피라이팅 조회 - @GetMapping("/{index}") + @GetMapping("/{index}") //copy/0=> 0-30 copy/1=>0~30 copy/2=>60~90 copy/9 => 270~300 public HttpRes> copyList(HttpServletRequest httpRequest,@PathVariable int index) { Long[] brandIds = {2L, 3L, 4L, 12L, 15L, 17L, 21L, 24L, 25L, 28L}; diff --git a/src/main/java/shop/hooking/hooking/controller/RefererController.java b/src/main/java/shop/hooking/hooking/controller/RefererController.java new file mode 100644 index 0000000..73574ee --- /dev/null +++ b/src/main/java/shop/hooking/hooking/controller/RefererController.java @@ -0,0 +1,30 @@ +package shop.hooking.hooking.controller; + +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; + +@RestController +@RequiredArgsConstructor +@RequestMapping("/example") +public class RefererController { + + @GetMapping("/login") + public String login(HttpServletRequest request) { + // Referer 헤더 확인 + String referer = request.getHeader("Referer"); + System.out.println("Referer: " + referer); + + // Host 헤더 확인 + String host = request.getHeader("Host"); + System.out.println("Host: " + host); + + // 로그인 성공 후 리다이렉트할 URL 분기처리 등 추가 작업 수행 + + return "Login success"; + } +} +