-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: http 로 페이지 조회하면 https 로 리다이렉트 (#58)
- https origin 까지 포함한 full url 로 리다이렉트 - URI#resolve 를 사용한 안전한 url 합성 * feat: root 경로에서 trailing slash 처리 * feat: short url code 경로에서 trailing slash 처리 * refactor: controller 구조 변경 및 app/ 경로 처리 * refactor: 안 보는 주석 삭제 * feat: 안전한 URL 합성 - URI#resolve 사용 - origin 영역까지 연결하여 full url 생성
- Loading branch information
1 parent
daa4f13
commit 0619fb0
Showing
7 changed files
with
47 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/java/io/github/daengdaenglee/mangurl/inboundadapter/app/RootController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package io.github.daengdaenglee.mangurl.inboundadapter.app; | ||
|
||
import io.github.daengdaenglee.mangurl.config.properties.MangurlProperties; | ||
import org.springframework.stereotype.Controller; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
|
||
import java.net.URI; | ||
|
||
@Controller | ||
class RootController { | ||
private final String origin; | ||
|
||
RootController(MangurlProperties mangurlProperties) { | ||
this.origin = mangurlProperties.getOrigin(); | ||
} | ||
|
||
@RequestMapping({"", "/"}) | ||
String home() { | ||
var appUrl = URI.create(this.origin).resolve(AppController.basePath).toASCIIString(); | ||
return "redirect:" + appUrl; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
mangurl: | ||
origin: "http://localhost:8080/" | ||
origin: "http://localhost:8080" | ||
repository: | ||
type: "in-memory" |