Skip to content

Spring mvc에서 외부 url로 redirect 하는 경우 #3

@1876070677

Description

@1876070677

해당 게시글 참고. https://blerang055.tistory.com/6

리턴 타입이 string일 때, 외부 url인 /external 로 요청을 보내면, 현재 프로젝트의 url로 요청이 전달된다.

예를 들어, account 서비스가 톰캣에서 /account를 Application Context로 사용할 때, account 서비스에서 catalog 서비스로 요청을 보내기 위해 return "redirect:/catalog"; 을 하면, localhost:8080/account/catalog 로 요청이 전달된다.

우리의 목적은 localhost:8080/catalog 로 요청을 전달하는 것이므로, return "redirect:http://localhost:8080/catalog"; 로 명확하게 기술해야 한다.

다음은 해당 수정이 이루어진 커밋: a8118f6

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions