Skip to content

Derive iOS inspector URL scheme from bundle URL for HTTPS support#55871

Closed
cipolleschi wants to merge 4 commits intofacebook:mainfrom
cipolleschi:export-D95037969
Closed

Derive iOS inspector URL scheme from bundle URL for HTTPS support#55871
cipolleschi wants to merge 4 commits intofacebook:mainfrom
cipolleschi:export-D95037969

Conversation

@cipolleschi
Copy link
Copy Markdown
Contributor

Summary:

Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in RCTInspectorDevServerHelper, instead of
hardcoding http://. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

Test Plan:

Verified that getInspectorDeviceUrl and openDebugger now use the bundle
URL's scheme, falling back to http when no scheme is available.

Facebook:

Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Differential Revision: D95037969

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Mar 3, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 3, 2026

@cipolleschi has exported this pull request. If you are a Meta employee, you can view the originating Diff in D95037969.

Copy link
Copy Markdown
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

Riccardo Cipolleschi added 3 commits March 4, 2026 03:49
Summary:
## Summary:

Derive the WebSocket scheme (ws/wss) and port from the dev server URL in
`setUpReactDevTools.js` so React DevTools connections work correctly when the
dev server is accessed over HTTPS.

The Android `OkHttpClientProvider` and `WebSocketModule` changes from the
original ATOD patch are intentionally omitted because these are production
modules that cannot depend on the dev-only `DevSupportHttpClient` module
due to Buck module boundaries.

## Changelog:

[GENERAL][CHANGED] - Derive WebSocket scheme and port from dev server URL for React DevTools connections, supporting HTTPS dev servers

## Test Plan:

Validated that the JS change correctly derives ws/wss scheme and port from the
dev server URL, falling back to ws://host:8097 for local development.

## Facebook:
Partially applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+004+atod-websocket.patch
(Android OkHttpClientProvider and WebSocketModule changes omitted — they create
an invalid Buck dependency from production modules to dev-only modules)

Differential Revision: D95043354
Summary:
## Summary:

Replace the blind application of dev headers on all WebSocket connections with
a provider pattern that mirrors RCTHTTPRequestHandler's
NSURLSessionConfigurationProvider. A custom `SRWebSocketProvider` block can be
registered via `RCTSetCustomSRWebSocketProvider` to intercept WebSocket
creation and selectively modify the request (e.g. injecting auth headers) for
specific endpoints. If no provider is set, or if the provider returns nil,
the default SRWebSocket creation logic is used.

- Declare `SRWebSocketProvider` typedef and `RCTSetCustomSRWebSocketProvider`
  in RCTWebSocketModule.h
- Implement the provider hook in RCTWebSocketModule.mm
- Remove the previous blind `RCTDevSupportHttpHeaders` application

## Changelog:

[IOS][CHANGED] - Add SRWebSocketProvider for selective WebSocket header injection

## Test Plan:

Verified that the `SRWebSocketProvider` block is called when registered, and
that returning nil falls back to the default SRWebSocket creation. When no
provider is registered, behavior is unchanged from before.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+005+atod-websocket-ios.patch

Differential Revision: D95037876
Summary:
## Summary:

Replace the blind application of dev headers on all HTTP requests with an
interceptor pattern. A custom `RCTHTTPRequestInterceptor` block can be
registered via `RCTSetCustomHTTPRequestInterceptor` to inspect and modify
HTTP requests before they are sent. The interceptor returns a modified request
to override, or nil to use the original request unchanged. This preserves the
shared NSURLSession configuration (including meta-auth mTLS) while allowing
selective per-request header injection.

- Declare `RCTHTTPRequestInterceptor` typedef and
  `RCTSetCustomHTTPRequestInterceptor` in RCTHTTPRequestHandler.h
- Implement the interceptor hook in RCTHTTPRequestHandler.mm
- Remove the previous blind `RCTDevSupportHttpHeaders` application

## Changelog:

[IOS][CHANGED] - Add RCTHTTPRequestInterceptor for selective HTTP request modification

## Test Plan:

Verified that the RCTHTTPRequestInterceptor block is called when registered,
and that returning nil leaves the original request unchanged. When no
interceptor is registered, behavior is unchanged from before.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+006+atod-ios-http-handler.patch

Differential Revision: D95037920
@cipolleschi cipolleschi force-pushed the export-D95037969 branch 2 times, most recently from 1c8e1dd to b7dae09 Compare March 4, 2026 11:55
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:
Pull Request resolved: facebook#55871

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:
Pull Request resolved: facebook#55871

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:
Pull Request resolved: facebook#55871

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
@cipolleschi cipolleschi force-pushed the export-D95037969 branch 2 times, most recently from d9a4860 to f47bd1c Compare March 4, 2026 12:41
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
cipolleschi added a commit to cipolleschi/react-native that referenced this pull request Mar 4, 2026
…cebook#55871)

Summary:
Pull Request resolved: facebook#55871

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
…cebook#55871)

Summary:
Pull Request resolved: facebook#55871

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969
@meta-codesync meta-codesync bot closed this in 36dfcef Mar 4, 2026
@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Mar 4, 2026
@meta-codesync
Copy link
Copy Markdown

meta-codesync bot commented Mar 4, 2026

This pull request has been merged in 36dfcef.

zoontek pushed a commit to zoontek/react-native that referenced this pull request Mar 9, 2026
…cebook#55871)

Summary:
Pull Request resolved: facebook#55871

## Summary:

Use the bundle URL's scheme (http or https) when constructing inspector device
URLs and open-debugger URLs in `RCTInspectorDevServerHelper`, instead of
hardcoding `http://`. This allows the inspector and debugger to work correctly
when the dev server is accessed over HTTPS.

## Changelog:

[IOS][CHANGED] - Derive inspector and debugger URL scheme from bundle URL to support HTTPS dev servers

## Test Plan:

Verified that `getInspectorDeviceUrl` and `openDebugger` now use the bundle
URL's scheme, falling back to `http` when no scheme is available.

## Facebook:
Applied from nest/mobile/apps/atod-sample/patches/react-native+0.83.1+007+atod-ios-inspector-https.patch

Reviewed By: cortinico

Differential Revision: D95037969

fbshipit-source-id: 0e6729c2b91827655f4093dec890ad086e42facf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants