feat: add native-first inbound and outbound proxy rules#479
feat: add native-first inbound and outbound proxy rules#479riderx wants to merge 1 commit intodevelopmentfrom
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3f59d284f5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var proxyHandler: ProxySchemeHandler? = nil | ||
| if proxyRequests { | ||
| proxyHandler = ProxySchemeHandler(plugin: self, webviewId: webViewId) | ||
| if proxyRequests || !outboundProxyRules.isEmpty || !inboundProxyRules.isEmpty { |
There was a problem hiding this comment.
Enable iOS proxy path when only native rules are set
This branch now creates a ProxySchemeHandler when rule arrays are provided, but the webview still receives proxyRequests: false in rules-only mode, and WKWebViewController.initWebview registers the http/https scheme handler only when proxyRequests is true (WKWebViewController.swift:679). In practice, outboundProxyRules/inboundProxyRules configured without proxyRequests never run on iOS, so the new native-first rule feature is silently disabled.
Useful? React with 👍 / 👎.
| NativeResponseData nativeResponse; | ||
| try { | ||
| nativeResponse = performNativeRequest(requestContext); |
There was a problem hiding this comment.
Preserve direct request bodies on Android pass-through
After outbound handling, the code unconditionally replays requests via performNativeRequest instead of letting unmatched/null-decision requests continue through WebView. For non-/_capgo_proxy_ requests, request bodies are unavailable and initialized as empty, so POST/PUT form navigations are resent without payload. That changes legacy proxyRequests pass-through semantics and can break server-side form/auth flows whenever proxying is enabled.
Useful? React with 👍 / 👎.
| self.pendingTasks.removeValue(forKey: requestId) | ||
| self.taskLock.unlock() | ||
|
|
||
| task.didFailWithError(NSError( | ||
| pendingTask.schemeTask.didFailWithError(NSError( |
There was a problem hiding this comment.
Cancel proxy timeout once JS decision is received
The timeout always removes a still-pending task after 10 seconds and fails it, but tasks remain in pendingTasks while executeNativePipeline is running after a valid outbound JS response. On slow upstream responses, delegated requests can be aborted at 10s even though JS answered in time, causing spurious NSURLErrorTimedOut failures.
Useful? React with 👍 / 👎.



Summary
Verification