Files
qipai/scripts/dev/windows/check-api-domain.ps1
T
2026-06-15 16:34:36 +08:00

28 lines
727 B
PowerShell

$ErrorActionPreference = "Stop"
$Domain = "api.txyundm.cn"
$Origin = "https://$Domain"
$Paths = @(
"/health",
"/app-api/health",
"/admin-api/health"
)
Write-Host "INFO: checking DNS for $Domain"
try {
Resolve-DnsName -Name $Domain -ErrorAction Stop | Select-Object -First 3 | Format-Table -AutoSize
} catch {
Write-Warning "DNS check failed from Windows: $($_.Exception.Message)"
}
foreach ($Path in $Paths) {
$Url = "$Origin$Path"
Write-Host "INFO: probing $Url"
try {
$Response = Invoke-WebRequest -Uri $Url -Method Head -TimeoutSec 10 -ErrorAction Stop
Write-Host "PASS: $Url -> $($Response.StatusCode)"
} catch {
Write-Warning "HTTPS probe failed for ${Url}: $($_.Exception.Message)"
}
}