Skip to content

Conversation

@kalined
Copy link

@kalined kalined commented Oct 27, 2025

The dotnet install scripts previously assumed every non-final HTTP status in the aka.ms redirect chain must be 301. Some proxies inject additional HTTP response blocks, such as "200 Connection Established", which caused valid redirect chains to be treated as broken.

This change:

  • In Bash: find the last terminal HTTP status (2xx/4xx/5xx), consider only codes before that as the redirect chain, and trim trailing 1xx/2xx entries from it (proxy markers). Then assert all remaining redirect codes are 301.
  • In PowerShell: apply the equivalent logic inside Get-AkaMSDownloadLink.

Includes tests/harnesses for local verification and comments explaining the reason for trimming proxy-injected statuses.

Fixes: related issue in actions/setup-dotnet#650

Summary

Some proxy appliances (e.g. Zscaler) inject HTTP responses into the header
stream (for example, HTTP/1.1 200 Connection Established) during TLS CONNECT
or other proxy operations. The install scripts previously treated any
non-final status in the header stream that is not 301 as a broken redirect
chain, which incorrectly flagged valid redirects as broken.

This PR makes the aka.ms redirect detection robust by:

  • Finding the last terminal HTTP status (2xx/4xx/5xx) in the observed stream.
  • Treating only the statuses before that terminal response as the redirect chain.
  • Trimming trailing 1xx/2xx statuses from that pre-terminal chain (these are commonly proxy markers).
  • Requiring the remaining redirect statuses to be 301 (unchanged semantics).

The change is implemented in:

  • externals/install-dotnet.sh (Bash)
  • dotnet-install.ps1 (PowerShell)

Why

This fixes cases where a successful redirect chain would be incorrectly
treated as broken when proxies inject connection-establishment responses.

Files changed

  • externals/install-dotnet.sh — update get_download_link_from_aka_ms() redirect parsing
  • dotnet-install.ps1 — update Get-AkaMSDownloadLink() redirect parsing

The dotnet install scripts previously assumed every non-final HTTP status
in the aka.ms redirect chain must be 301. Some proxies inject additional HTTP
response blocks such as "200 Connection Established",
which caused valid redirect chains to be treated as broken.

This change:
- In Bash: find the last terminal HTTP status (2xx/4xx/5xx), consider only
  codes before that as the redirect chain, and trim trailing 1xx/2xx
  entries from it (proxy markers). Then assert all remaining redirect codes
  are 301.
- In PowerShell: apply the equivalent logic inside Get-AkaMSDownloadLink.

Includes tests/harnesses for local verification and comments explaining the
reason for trimming proxy-injected statuses.

Fixes: related discussion in actions/setup-dotnet#650
@kalined
Copy link
Author

kalined commented Oct 27, 2025

@dotnet-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

The dotnet-install scripts don't handle proxy-injected redirect responses

1 participant