https 설정 2

[Spring] Swagger https 설정하기 (springdoc)

api의 도메인이 https 프로토콜을 사용하면서 swagger에서 CORS 오류가 발생하는 문제가 나타났다. 이는 Swagger가 기본적으로 http로 요청을 보내게 설정되어있기 때문이다. 이는 @OpenAPIDefinition 어노테이션으로 수정해주면 된다. ... import io.swagger.v3.oas.annotations.OpenAPIDefinition; import io.swagger.v3.oas.annotations.servers.Server; ... @OpenAPIDefinition(servers = {@Server(url = "/", description = "Default Server URL")}) @SpringBootApplication public class MyApplicati..

[Cloudflare] ec2로 배포한 서버에 무료로 https 설정하는 법 (Mixed Content 에러 해결법)

Mixed Content 에러... 프론트를 https로 배포 후 http로 서버와 통신하려하면 발생하는 문제다. 이 문제를 해결하기 위해서는 백엔드에서 http -> https로 접근할 수 있게 설정을 해줘야한다. 필자는 Spring Boot로 api를 개발하여 AWS EC2에 배포한 상황이였고 https로 설정하기 위해 찾아본 방법 중 간단하고 저렴한 방법에는 아래와 같은 방법들이 있었다. 1. AWS CloudFront 먼저 AWS의 CloudFront를 활용한 방법이다. 클라이언트가 https로 CloudFront와 통신을 하고 CloudFront와 api를 제공하는 주체는 http로 통신하는 것이다. ACM을 사용하면 ssl 인증서를 공짜로 이용할 수 있다. 후술하겠지만 CloudFront는 C..

Infra/Cloudflare 2023.01.25
반응형