Fixes for improving local development with Android Emulator #14372
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this change?
You can preview DCAR rendered pages locally on the Android Simulator. Setting up this flow raises two issues:
This looks like its related to using chrome://inpector
1/ Android app makes regular requests every second to/json/version
and/json/list
- these are hitting the local serverdotcom-rendering/src/server/server.dev.ts
which attempts to redirect them creating a non-stop stream of console logs. Changes the dev server to stop trying to redirect requests to/json/*
2/ Android simulator runs within it's own localhost sandbox. Requests to the host machine are networked via IP 10.0.2.2. This means that when serving locally rendered DCAR App Article pages, the html is trying to download the javascript for client-side hydration from
src="http://localhost:3030/assets/index.client.apps.js
which gets blocked by the emulator security settings:net::ERR_CLEARTEXT_NOT_PERMITTED
. Rather than loosen localhost defualt security settings we can serve the the file fromsrc="http://10.0.2.2:3030/assets/index.client.apps.js
instead.This is not the case for iOS so we need to include both html script tags on the local server. Local hydration is needed to properly test and develpt Bridget API implementations locally.
Why?
Screenshots