설명
https_only = true는 App Service로 들어오는 HTTP 요청을 HTTPS로 리디렉션합니다. 앱 링크와 API 클라이언트에는 처음부터 HTTPS 주소를 사용하세요.
잠재적 영향
최초 요청이 HTTP라면 리디렉션 전에 보낸 로그인 정보, 세션 쿠키나 입력값은 평문 상태로 노출되거나 변조될 수 있습니다.
해결 방법
https_only를 켠 뒤 민감한 정보가 없는 HTTP 요청으로 HTTPS 리디렉션을 확인하세요. 실제 로그인과 API 호출은 첫 요청부터 유효한 인증서로 HTTPS에 연결되는지 시험하세요. 최소 TLS 버전, 쿠키의 Secure 속성, 적절한 HSTS 정책과 사용자 인증·인가도 확인하세요.
예시
예시는 AzureRM 3.x의 azurerm_app_service에서 https_only만 바꿉니다. 현재 Linux·Windows Web App 리소스도 같은 속성을 지원합니다.
변경 전
hcl
resource "azurerm_app_service" "example" {
name = "example-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
site_config {
dotnet_framework_version = "v4.0"
scm_type = "LocalGit"
}
https_only = false
}
변경 후
hcl
resource "azurerm_app_service" "example" {
name = "example-app-service"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
app_service_plan_id = azurerm_app_service_plan.example.id
site_config {
dotnet_framework_version = "v4.0"
scm_type = "LocalGit"
}
https_only = true
}