๊ฐ๋จํ๊ฒ HelloController.java๋ฅผ ๋ง๋ค์ด์ CI/CD๋ฅผ ํด๋ณด์๋ค.
๋ฐฐํฌ๊ฐ ๋จผ์ ๋์ด์์ผ๋ฉด ํธํ๊ธฐ ๋๋ฌธ์ด๋ค!
@RestController
public class HelloController {
@GetMapping("/api/hello")
public String hello() {
return "hello controller";
}
}
https://domain.store:8080/api/hello
๋ฅผ ์
๋ ฅํ๋๋ฐ ๊ณ์
https://domain.store:8443/api/hello
์ผ๋ก redirect๊ฐ ๋๊ณ ์ํ๋ hello controller ๋ผ๋ ๋ฌธ์๊ฐ ๋ณด์ด์ง ์์๊ณ ํ์ด์ง์ ์ค๋ฅ๊ฐ ๋ฌ๋ค๊ณ ํ๋ค.
์ฒ์์ ์ธํ ์ ํ ๋,
- Lombok
- JPA
- Web
- Validation
- MySQL
- Security: ๋์ค์ ํ์๊ฐ์
/ ๋ก๊ทธ์ธ API๋ฅผ ๊ตฌํํ๊ธฐ ์ํด
์ด๋ ๊ฒ dependency๋ฅผ ์ถ๊ฐํ์๋ค.
์๊ฑฐ๊ฐ ๋ฌธ์ ์๋ค. ์ด ๋ฌธ์ ์ ์๋ฐ์
netstat -ntup
netstat -tuln | grep 443
netstat -tuln | grep 80
netstat -tuln | grep 8080
netstat -tuln | grep 22
์ด๊ฒ ์ ๊ฒ ๋ช ๋ น์ด๋ฅผ ๊ณ์ ์ ๋ ฅํด๋ณด์๋ค.....
๊ณ์ ์ค๋ฅ๊ฐ ๋๊ณ redirect๊ฐ ๋ผ์ ๋ช ์๊ฐ๋์ ๊ณ์ ์ฝ์ง์ ํ์๋ค.
ํน์๋ ํ๋ ๋ง์์ Security๋ฅผ exclude ํด๋ณด์๋ค.
@SpringBootApplication(exclude = SecurityAutoConfiguration.class)
๊ฐ์ด ์ค๋ฅ๋ฅผ ํด๊ฒฐํ๋ ๋ถ์ด ์ค๋ฅ๊ฐ ํด๊ฒฐ๋ ํ ๊ณต์๋ฌธ์๋ฅผ ์ฐพ์๋ณด์๋ค๊ณ ํ๋ค.
Web Application Security : port-mappings
By default, an instance of PortMapperImpl will be added to the configuration for use in redirecting to secure and insecure URLs. This element can optionally be used to override the default mappings which that class defines. Each child element defines a pair of HTTP:HTTPS ports. The default mappings are 80:443 and 8080:8443. An example of overriding these can be found in Redirect to HTTPS.
Security AutoConfigure๋ฅผ ์ฌ์ฉํ๊ฒ ๋๋ฉด https์ ๋งคํ๋ ํฌํธ๋ก ๋ฆฌ๋ค์ด๋ ํธ๊ฐ ๋๋ค.
Spring Boot ์์ ์ ๊ณตํ๋ ๋ด์ฅ Tomcat์ ์ฌ์ฉํ๊ฒ ๋๋ฉด default port๊ฐ 8080์ด๊ธฐ ๋๋ฌธ์ 8443์ผ๋ก ๊ณ์ ๋ฆฌ๋ค์ด๋ ํธ๊ฐ ๋ ๊ฒ์ด๋ค!
- 80 : 443
- 8080 : 8443
์ด๋ ๊ฒ ๋งคํ์ด ๋์ด์๋ค.
์ฌ๋ฌ๊ฐ์ง ํด๊ฒฐ๋ฒ์ด ์์ง๋ง Security๋ฅผ exclude ํ๋ ๊ฒ์ผ๋ก ํด๊ฒฐํ์๋ค.
IT, ์ํต์ ์ง๊ฒ๋ค๋ฆฌ : [230807] Java Security AutoConfigure๊ฐ ๋ ๋ Https Port ๋งคํ