Global feature flags
Feature flags are configured when creating aScramjetController instance:
Available flags
serviceworkers
Type:boolean
Default: false
Enables service worker support within proxied pages.
syncxhr
Type:boolean
Default: false
Enables synchronous XMLHttpRequest support.
Synchronous XHR is deprecated in modern browsers. Enable this only for legacy compatibility.
strictRewrites
Type:boolean
Default: true
Enforces strict URL rewriting rules to ensure all URLs are properly proxified.
rewriterLogs
Type:boolean
Default: false
Enables verbose logging from the URL rewriter for debugging purposes.
captureErrors
Type:boolean
Default: true
Captures and handles JavaScript errors within proxied contexts.
cleanErrors
Type:boolean
Default: false
Cleans error stack traces to remove proxy-related information.
scramitize
Type:boolean
Default: false
Enables additional obfuscation and protection mechanisms.
sourcemaps
Type:boolean
Default: true
Enables source map support for better debugging of rewritten JavaScript.
destructureRewrites
Type:boolean
Default: false
Uses destructuring patterns in rewritten code for potentially better performance.
interceptDownloads
Type:boolean
Default: false
Intercepts file downloads and fires download events that you can handle.
allowInvalidJs
Type:boolean
Default: true
Allows execution of JavaScript that may not parse correctly.
Some websites use non-standard JavaScript that may not parse correctly. This flag provides better compatibility at the cost of stricter error checking.
allowFailedIntercepts
Type:boolean
Default: true
Allows requests to proceed even if interception fails.
Site-specific flag overrides
You can override flags for specific domains using thesiteFlags configuration:
Common configuration presets
Here are some common flag configurations for different use cases:- Development
- Production
- Maximum compatibility
- Maximum security
Modifying configuration at runtime
You can modify the configuration after initialization using themodifyConfig() method:
Configuration changes are persisted to IndexedDB and synchronized with the service worker.
Debugging flag issues
If you’re experiencing issues with specific flags, enablerewriterLogs to see detailed information:
Related guides
Basic setup
Learn the basics of setting up Scramjet
Event handling
Handle events triggered by different flags