(req: express.Request, res: express.Response)
| 849 | // Redirect through AAO session bridge if on AdCP without a session cookie. |
| 850 | // Returns true if a redirect was issued (caller should return early). |
| 851 | private bridgeIfNeeded(req: express.Request, res: express.Response): boolean { |
| 852 | // Skip the bridge for clients that don't send cookies (agents, curl, bots). |
| 853 | // They will never have a session to bridge, so the redirect is pointless |
| 854 | // and creates an infinite loop for clients without a cookie jar. |
| 855 | if (!req.headers.cookie) return false; |
| 856 | |
| 857 | if (this.isAdcpDomain(req) && !req.cookies?.['wos-session'] && !req.cookies?.['bridge-checked']) { |
| 858 | const currentUrl = `https://${req.hostname}${req.originalUrl}`; |
| 859 | res.redirect(`https://agenticadvertising.org/auth/bridge?return_to=${encodeURIComponent(currentUrl)}`); |
| 860 | return true; |
| 861 | } |
| 862 | return false; |
| 863 | } |
| 864 | |
| 865 | /** |
| 866 | * Serve an HTML file with APP_CONFIG injected. |
no test coverage detected