A powerful Chrome/Brave/Edge browser extension that intercepts and redirects API requests from a source URL to a target URL while preserving all headers, parameters, and request bodies.
β¨ Request Interception & Redirection
- Intercept requests matching a source URL prefix
- Redirect them to a target URL transparently
- All headers, query parameters, and request bodies are preserved
π Header Preservation
- All original request headers are automatically copied to redirected requests
- Authorization headers, cookies, and custom headers are maintained
- CORS headers are handled correctly
π Query Parameters & Path Preservation
- URL parameters and query strings are automatically included
- Request paths are properly appended to the target URL
- Full payload bodies are forwarded
ποΈ Easy Configuration
- Simple popup interface for quick setup
- Advanced options page for detailed configuration
- Enable/disable toggle for quick activation
π Debug Logging
- Real-time logging of intercepted requests
- Request details and redirect information
- Status tracking and configuration display
- Clone or download this repository
- Open your browser and navigate to
chrome://extensions/(Chrome) orbrave://extensions/(Brave) - Enable "Developer mode" (toggle in top-right corner)
- Click "Load unpacked" and select the extension folder
- The extension will appear in your extensions list
The extension uses Manifest V3 which is Chrome-based. Firefox support would require a Manifest V2 conversion.
- Click the Netreq icon in your browser toolbar
- Enter Source URL Prefix: The URL prefix to intercept (e.g.,
https://backendhach.com) - Enter Target/Redirect URL: Where requests should go (e.g.,
https://staging-api.example.com) - Click "Save Configuration"
- Enable the toggle to activate request redirection
Configuration:
- Source Prefix:
https://api.myapp.com - Target URL:
https://api.staging.com
Result:
- Request to:
https://api.myapp.com/users/123?role=admin - Gets redirected to:
https://api.staging.com/users/123?role=admin - All headers (Authorization, Content-Type, etc.) are preserved
- Request body (if POST/PUT/PATCH) is forwarded as-is
1. Browser initiates request
β
2. Extension's background service worker intercepts it
β
3. Checks if URL matches source prefix
β
4. If match found:
- Extracts endpoint/path from original URL
- Constructs new URL with target URL + endpoint
- Preserves all headers
- Preserves request body
β
5. Redirects request to target URL
β
6. Browser sends request with all original details
netreq-extension/
βββ manifest.json # Extension configuration and permissions
βββ background.js # Main request interception logic
βββ popup.html # Quick settings popup
βββ popup.js # Popup functionality
βββ options.html # Advanced settings page
βββ options.js # Options page functionality
βββ styles.css # Styling for popup and options
βββ images/ # Extension icons (16x16, 48x48, 128x128)
webRequest- Intercept HTTP requestswebRequestBlocking- Block and modify requestsstorage- Store configuration locallytabs- Access tab informationwebNavigation- Monitor page navigation
- Intercepts requests using
chrome.webRequest.onBeforeRequest - Modifies headers using
chrome.webRequest.onBeforeSendHeaders - Handles response headers with
chrome.webRequest.onHeadersReceived - Logs request completion and errors
- Manages configuration storage
- Quick toggle to enable/disable redirection
- Configure source and target URLs
- Display current status
- Auto-save functionality
- Detailed configuration interface
- Advanced settings
- Debug logging interface
- Import/export configuration
- Clear log functionality
Configurations are stored in Chrome's local storage as JSON:
{
"enabled": true,
"sourcePrefix": "https://api.myapp.com",
"targetUrl": "https://api.staging.com"
}- Uses prefix matching (not full URL matching)
- Source prefix should include protocol (http/https)
- Trailing slashes matter:
https://api.comβhttps://api.com/
The extension logs all intercepted requests to the browser console and the debug panel:
- Request URL
- Redirect target
- Response status code
- Any errors encountered
All headers are automatically preserved:
- Authorization headers (Bearer tokens, API keys, etc.)
- Content-Type headers
- Custom headers
- CORS headers
- Cookies
- POST, PUT, PATCH request bodies are fully preserved
- JSON payloads are maintained
- Form data is preserved
- File uploads are handled correctly
- Check if extension is enabled: Look at popup status
- Verify source prefix: Make sure it exactly matches the request URL
- Check configuration: Open options page to see saved settings
- Look at debug log: Check the options page debug console for errors
The extension copies headers automatically. If specific headers are missing:
- Check browser console for errors
- Verify the target server accepts the headers
- Some security headers might be filtered by the browser
If you see CORS errors:
- The extension doesn't bypass CORS - it only redirects requests
- The target server must accept requests from your origin
- Configure appropriate CORS headers on the target server
- The extension only operates on locally-stored configuration
- No data is sent to external servers
- All redirection happens locally in the browser
- Configuration is stored only in Chrome's local storage
- Manifest V3 only (Chrome/Brave/Edge)
- Cannot redirect WebSocket connections (only HTTP/HTTPS)
- Cross-origin redirects may fail due to browser security restrictions
- Cannot modify some security-related headers
- Edit the relevant file (background.js, popup.js, etc.)
- Reload the extension in
chrome://extensions/ - Test in your browser
- Open the extension popup to check basic functionality
- Open the options page to view debug logs
- Open DevTools (F12) β Background page to see background script logs
- Monitor Network tab to verify redirects
This extension is provided as-is for personal and educational use.
For issues or feature requests, please check:
- Debug log in options page
- Browser console for errors
- Ensure configuration is correct
- Verify target URL is accessible
Version: 1.0.0
Compatibility: Chrome 88+, Brave, Edge, other Chromium-based browsers