Routes HTTPS requests to UID sample sites based on subdomain. This setup allows you to use the integration environment operator (no local operator required).
Before running the sample sites, create a .env file in the project root (uid2-examples/) with your API credentials.
-
Copy one of the sample files:
# For UID2 cp .env.sample.uid2 .env # For EUID cp .env.sample.euid .env
-
Edit
.envand add your credentials:UID_API_KEY- Your API keyUID_CLIENT_SECRET- Your client secretUID_CSTG_SERVER_PUBLIC_KEY- Your CSTG public keyUID_CSTG_SUBSCRIPTION_ID- Your CSTG subscription ID
-
Keep the integ operator URLs (these are the defaults in the sample files):
UID_SERVER_BASE_URL=https://operator-integ.uidapi.comUID_CLIENT_BASE_URL=https://operator-integ.uidapi.com
Note: Unlike the localhost setup, this reverse-proxy approach uses HTTPS with custom domains (
*.sample-dev.com), which allows you to connect to the hosted integ operator instead of requiring a local operator.
See the sample files for all available configuration options.
cd /path/to/uid2-examples
npm install
npm run createCAsudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain ./ca/ca.crtEnter your password when prompted.
Windows instructions
- Double-click
ca/ca.crt - Click
Install Certificate...→Current User→Next - Select
Place all certificates in the following store→Browse... - Choose
Trusted Root Certification Authorities→OK→Next→Finish
Open your hosts file:
# macOS/Linux
sudo nano /etc/hosts
# Windows (run Notepad as Administrator)
# Open: C:\Windows\System32\drivers\etc\hostsAdd these entries:
127.0.0.1 sample-dev.com
127.0.0.1 js-client-side.sample-dev.com
127.0.0.1 js-client-server.sample-dev.com
127.0.0.1 js-react.sample-dev.com
127.0.0.1 server-side.sample-dev.com
127.0.0.1 secure-signals-client-server.sample-dev.com
127.0.0.1 secure-signals-client-side.sample-dev.com
127.0.0.1 secure-signals-server-side.sample-dev.com
127.0.0.1 secure-signals-react.sample-dev.com
127.0.0.1 prebid-client.sample-dev.com
127.0.0.1 prebid-client-server.sample-dev.com
127.0.0.1 prebid-deferred.sample-dev.com
127.0.0.1 prebid-secure-signals.sample-dev.com
127.0.0.1 hashing-tool.sample-dev.com
Flush DNS cache after saving:
# macOS
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderdocker-compose up -dImportant: This starts ALL containers (reverse-proxy + all sample sites). The reverse-proxy only routes traffic—it doesn't contain the sites themselves.
Go to https://sample-dev.com — this index page has clickable links to all sample sites.
| URL | Description | Port |
|---|---|---|
https://sample-dev.com |
Index page (links to all sites) | — |
https://js-client-side.sample-dev.com |
JavaScript SDK Client Side | 3031 |
https://js-client-server.sample-dev.com |
JavaScript SDK Client Server | 3032 |
https://server-side.sample-dev.com |
Server Side Integration | 3033 |
https://js-react.sample-dev.com |
JavaScript SDK React | 3034 |
https://secure-signals-client-server.sample-dev.com |
Google Secure Signals Client Server | 3041 |
https://secure-signals-client-side.sample-dev.com |
Google Secure Signals Client Side | 3042 |
https://secure-signals-server-side.sample-dev.com |
Google Secure Signals Server Side | 3043 |
https://secure-signals-react.sample-dev.com |
Google Secure Signals React | 3044 |
https://prebid-client.sample-dev.com |
Prebid Client Side | 3051 |
https://prebid-client-server.sample-dev.com |
Prebid Client Server | 3052 |
https://prebid-deferred.sample-dev.com |
Prebid Client Side Deferred | 3053 |
https://prebid-secure-signals.sample-dev.com |
Prebid Secure Signals | 3061 |
https://hashing-tool.sample-dev.com |
Hashing Tool | 3071 |
- Make sure you trusted the CA certificate (step 2)
- Fully quit Chrome (Cmd+Q) and reopen it
- Verify trust worked:
security dump-trust-settings -d | grep -A2 "UID2 Examples"
The backend service isn't running. Make sure you ran docker-compose up -d (not just the reverse-proxy).
- Check hosts file entries are correct
- Flush DNS cache
- Make sure you're using
https://nothttp://
If you add new domains or delete the ca/ folder:
npm run createCA
# Then re-trust the CA certificate (step 2)You can skip all certificate setup and access services directly via localhost:
| URL | Service |
|---|---|
http://localhost:3051 |
Prebid Client Side |
http://localhost:3052 |
Prebid Client Server |
http://localhost:3053 |
Prebid Client Side Deferred |
http://localhost:3071 |
Hashing Tool |
http://localhost:3031 |
JavaScript SDK Client Side |
| (etc.) |
This bypasses the reverse-proxy entirely—no HTTPS, no subdomains needed.