[CmdletBinding()] param( [string]$Url = 'http://127.0.0.1:8000/' ) $ErrorActionPreference = 'Stop' $headers = @{ 'X-Forwarded-For' = '192.0.2.10' 'X-Forwarded-Proto' = 'https' 'X-Real-IP' = '192.0.2.10' } try { $response = Invoke-WebRequest -Uri $Url -Headers $headers -UserAgent 'popovdev-scriptdock/1.0' -MaximumRedirection 5 -UseBasicParsing } catch { Write-Error ("Request failed: {0}" -f $_.Exception.Message) exit 1 } Write-Host ("URL: {0}" -f $Url) Write-Host ("Status: {0}" -f [int]$response.StatusCode) Write-Host '' $interesting = @('Server', 'Via', 'X-Cache', 'X-Forwarded-For', 'X-Forwarded-Proto', 'X-Real-IP', 'Forwarded', 'Age', 'Cache-Control', 'Content-Type') foreach ($key in $interesting) { $value = $response.Headers[$key] if ($null -ne $value) { Write-Host ("{0}: {1}" -f $key, ($value -join ', ')) } } $keys = @($response.Headers.Keys) if ($keys -contains 'X-Forwarded-For') { Write-Warning 'Ответ содержит X-Forwarded-For: убедитесь, что прокси перезаписывает этот заголовок.' } if ($keys -notcontains 'Via' -and $keys -notcontains 'X-Cache' -and $keys -notcontains 'Age') { Write-Host 'Признаки прокси или CDN в ответе не найдены.' }