swg.js (the Reader Revenue Manager client library) enforce strict origin verification (window.location.origin). When testing against production OAuth client IDs where adding ad-hoc localhost or custom origins in the Google Cloud Console is not possible, the client application must run on an already authorized origin (e.g., https://reader-revenue-demo.ue.r.appspot.com).8888 that intercepts HTTPS requests targeting reader-revenue-demo.ue.r.appspot.com:443, terminates TLS dynamically with a locally generated certificate, and reverse-proxies the decrypted HTTP request to the local Express app on port 8080.lib/ssl-proxy/certs.js)node:crypto, node:fs, and openssl with configuration templates in lib/ssl-proxy/templates/)..certs/ (configurable via SSL_CERTS_DIR).nameConstraints (permitted;DNS:reader-revenue-demo.ue.r.appspot.com) so the local CA cannot be used outside the configured target domain scope.lib/ssl-proxy/index.js & middleware/ssl-proxy.js)SSL_PROXY_ENABLED=true.0.0.0.0:8888 (configurable via SSL_PROXY_PORT).127.0.0.1:0) using dynamic SNI certificates from CertificateManager.8888:GET http://127.0.0.1:8888/health: Returns proxy status JSON.GET http://127.0.0.1:8888/ca.crt: Serves the Root CA public certificate.GET http://127.0.0.1:8888/proxy.pac: Serves a dynamic Proxy Auto-Config (PAC) script.CONNECT tunnels:reader-revenue-demo.ue.r.appspot.com:443): Routed to the internal HTTPS server, which terminates TLS, sets forwarding headers (Host, X-Forwarded-Proto: https, X-Forwarded-Host), and forwards requests to Express (127.0.0.1:8080).net.connect(targetPort, targetHost) piped directly between client and upstream socket..env)Enable and configure the proxy by adding the following variables to your .env file:
PORT=8080
HOST=0.0.0.0
ENV_NAME=local
PUBLICATION_ID=publisher-center-ppid.google.com
GOOGLE_APPLICATION_CREDENTIALS=/path/to/application_default_credentials.json
# SSL Proxy Configuration (Opt-In)
SSL_PROXY_ENABLED=true
SSL_PROXY_PORT=8888
SSL_TARGET_DOMAIN=reader-revenue-demo.ue.r.appspot.com
SSL_CERTS_DIR=.certs
Start the server (requires Node.js v24+):
npm run local
Verify proxy health:
curl -s http://127.0.0.1:8888/health
# Expected: {"status":"ok","proxyPort":8888,"targetDomains":["reader-revenue-demo.ue.r.appspot.com"],"appPort":8080}
Verify local HTTPS interception via curl:
curl -k -x http://127.0.0.1:8888 https://reader-revenue-demo.ue.r.appspot.com/
To keep setup as simple as possible without modifying your operating system's certificate keychain, quit any running instances of Chrome and launch it with --proxy-server and --ignore-certificate-errors:
google-chrome \
--proxy-server="http://127.0.0.1:8888" \
--ignore-certificate-errors \
https://reader-revenue-demo.ue.r.appspot.com/
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--proxy-server="http://127.0.0.1:8888" \
--ignore-certificate-errors \
https://reader-revenue-demo.ue.r.appspot.com/
Running Chrome in parallel (--user-data-dir)
If Chrome is already running, launching it from the terminal will open a new tab in your existing browser process and silently ignore command-line flags like --proxy-server and --ignore-certificate-errors.
If you want to run a proxied instance of Chrome in parallel to your existing one without closing your open windows, pass --user-data-dir="/tmp/chrome-dev-proxy" to launch an isolated browser profile.
Browser Proxy Extensions
If you use browser extensions that manage proxy settings (such as PAC or VPN extensions), ensure they are disabled so they do not override the --proxy-server command-line flag.