| 1234567891011121314151617181920212223242526272829303132333435363738 |
- # Debug proxy issue - test directly vs through proxy
- $body = '{"tenantCode":"T202605253515","username":"admin","password":"admin123"}'
- $loginResp = Invoke-WebRequest -Uri 'http://localhost:8006/login' -Method Post -ContentType 'application/json' -Body $body -UseBasicParsing
- $token = ($loginResp.Content | ConvertFrom-Json).token
- Write-Host "Direct login OK, token length: $($token.Length)"
- # Test HIS direct vs proxy
- $testPaths = @(
- '/his/healthTongue/list',
- '/his/healthRecord/list',
- '/course/courseDomainName/list',
- '/billing/wallet/list',
- '/transfer/fsTransfer/list',
- '/his/prescription/list'
- )
- foreach ($path in $testPaths) {
- # Direct
- try {
- $r = Invoke-WebRequest -Uri "http://localhost:8006$path" -Method Get -Headers @{Authorization="Bearer $token"} -UseBasicParsing -TimeoutSec 5
- $content = $r.Content | ConvertFrom-Json
- Write-Host "DIRECT $path => code=$($content.code)"
- } catch {
- Write-Host "DIRECT $path => ERROR: $($_.Exception.Message.Substring(0,50))"
- }
-
- # Through proxy
- try {
- $r = Invoke-WebRequest -Uri "http://localhost:80/prod-api$path" -Method Get -Headers @{Authorization="Bearer $token"} -UseBasicParsing -TimeoutSec 5
- $content = $r.Content | ConvertFrom-Json
- Write-Host "PROXY $path => code=$($content.code)"
- } catch {
- $statusCode = 0
- if ($_.Exception.Response) { $statusCode = [int]$_.Exception.Response.StatusCode }
- Write-Host "PROXY $path => $statusCode ERROR: $($_.Exception.Message.Substring(0,[Math]::Min(50,$_.Exception.Message.Length)))"
- }
- Write-Host ""
- }
|