Skip to main content
Scramjet provides a comprehensive set of feature flags that allow you to customize its behavior. These flags can be set globally or overridden on a per-site basis.

Global feature flags

Feature flags are configured when creating a ScramjetController instance:

Available flags

serviceworkers

Type: boolean Default: false Enables service worker support within proxied pages.
Enabling service workers in proxied contexts can be complex and may cause unexpected behavior. Only enable this if you need it.

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.
Keep this enabled for maximum security and reliability. Disabling it may allow some URLs to bypass the proxy.

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.
See Event handling for more details on download interception.

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 the siteFlags configuration:
Site-specific flags are useful when certain websites require different settings for compatibility.

Common configuration presets

Here are some common flag configurations for different use cases:

Modifying configuration at runtime

You can modify the configuration after initialization using the modifyConfig() method:
Configuration changes are persisted to IndexedDB and synchronized with the service worker.

Debugging flag issues

If you’re experiencing issues with specific flags, enable rewriterLogs to see detailed information:
You can also check which flags are currently active:

Basic setup

Learn the basics of setting up Scramjet

Event handling

Handle events triggered by different flags