azure-dev
azure-dev copied to clipboard
[codespaces] Web app does not follow redirects from "private" port
trafficstars
When hosting an API and Web app in codespaces the API URL must be made "Public" ... This is (partially) because the react app does not follow redirects when running in the client's browser.
Repro steps:
- Create codespaces instance against a sample repo (example)
- Provision resources
- Launch debug for the API
- Manually mark the port as "Private" (warning the "Ports" page may not reflect the accurate state of the port, use
gh codespace ports -c $CODESPACE_NAMEinstead) using thegh codespace ports visibility 3100:private -c $CODESPACE_NAME - Start the web app (debug not required)
- Launch the debug app
Expected: Page content loads properly Actual: Page content does not load
The request to get lists is redirected to an authentication experience:

Setting the port to public instead of private alleviates the problem.
In its current state, using codespaces with public ports is not significantly different from deploying the application itself using azd deploy. That is, deploying the application exposes swagger and API endpoints publicly, which is similar to using codespaces with a public API endpoint enabled.