feat: serve amiusing.requestly.io response inline from the proxy#99
feat: serve amiusing.requestly.io response inline from the proxy#99dinex-dev wants to merge 1 commit into
Conversation
Replaces the existing AmisuingMiddleware header-injection behaviour with a
direct response substitution: when a request hits amiusing.requestly.io, the
proxy writes a self-contained "Success" HTML page back to the client and
never forwards upstream. The page mirrors the existing amiusing.requestly.io
two-column "Yes" design (Success column + What's next doc links) and carries
a JSON marker (`{"amiusing": true}`) for programmatic detection.
This runs as a pre-rules middleware (registered via init_amiusing_handler),
so it short-circuits before the rule engine is consulted — the same pattern
ssl_cert_middleware uses for /ssl certificate downloads. It does not depend
on the rule system or on any desktop-app side changes beyond a dep bump.
Effect: with this proxy version installed, any client routed through the
desktop proxy that hits amiusing.requestly.io sees the Success page,
independent of what the origin currently serves. Once the origin migrates
to a static "No" page, only stale proxies still depend on the origin path.
The HTML body is extracted to amiusing_yes_page.js to keep the middleware
file focused on routing/handler logic. Bumps version to 1.3.15.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
WalkthroughThis PR implements a static "Am I Using Requestly" success page served directly from the proxy middleware. A new file defines the HTML template ( Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
commit: |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/proxy-middleware/middlewares/amiusing_middleware.js`:
- Around line 24-25: The host check is too strict and will miss matches when the
incoming host includes a port or different casing; update the condition that
uses ctx.proxyToServerRequestOptions.host and AMIUSING_HOST to compare
normalized hostnames by extracting the hostname (strip any port portion after
':' and remove surrounding IPv6 brackets if present), lowercasing and trimming
both sides, then compare equality (e.g., normalize incomingHost =
stripPortAndBrackets(ctx.proxyToServerRequestOptions.host).toLowerCase() and
compare to AMIUSING_HOST.toLowerCase()); return early only if they do not match.
In `@src/components/proxy-middleware/middlewares/amiusing_yes_page.js`:
- Line 86: Update the user-facing heading text in the AMI using "yes" page:
replace the current h2 content "What's next you ask ?" with properly punctuated
copy "What's next, you ask?" in the component that renders the <h2>
(amiusing_yes_page.js) so the displayed heading uses the comma and moves the
question mark directly after the phrase.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 36c346f1-4473-4a69-b2dc-815fee3420ac
⛔ Files ignored due to path filters (3)
dist/components/proxy-middleware/middlewares/amiusing_middleware.jsis excluded by!**/dist/**dist/components/proxy-middleware/middlewares/amiusing_yes_page.d.tsis excluded by!**/dist/**dist/components/proxy-middleware/middlewares/amiusing_yes_page.jsis excluded by!**/dist/**
📒 Files selected for processing (3)
package.jsonsrc/components/proxy-middleware/middlewares/amiusing_middleware.jssrc/components/proxy-middleware/middlewares/amiusing_yes_page.js
Summary
AmisuingMiddleware's header-injection with a direct response substitution: requests toamiusing.requestly.ioare answered locally with a self-contained Success HTML page, without ever forwarding upstream.ssl_cert_middleware's pattern — runs as a pre-rules middleware viainit_amiusing_handler, short-circuiting before the rule engine is consulted. No dependency on the rule system, the rule schema, or the requestly-coreBLACK_LIST_DOMAINScheck.{"amiusing": true}JSON marker) is extracted toamiusing_yes_page.jsfor readability; no build changes —tschandles the new module naturally.Why
Today the "Yes" indicator on
amiusing.requestly.iodepends on the proxy injecting a header that the origin's Next.js app reads. Once the origin migrates off Heroku to a static page (RQ-2153), the header path stops working. Serving the response inline from the proxy is durable across that migration and any future origin changes.Test plan
npm run build).requestly-desktop-app: through the desktop proxy,curl -x http://localhost:8281 http://amiusing.requestly.ioreturns the Success HTML; the request never reaches origin.Follow-up
requestly/requestly-desktop-app.🤖 Generated with Claude Code
Summary by CodeRabbit
Chores
New Features