feat(readme): add configuration details for link rewriting and update proxy URL handling
- Introduced a new section in the README for environment variable configuration related to link rewriting, specifying BACKEND_BASE_URL and BASE_URL usage. - Updated the clickTtHttpPageRoutes to dynamically construct the proxy base URL from environment variables, enhancing flexibility for different deployment environments.
This commit is contained in:
@@ -105,9 +105,10 @@ router.get('/proxy', async (req, res, next) => {
|
||||
.replace(/<meta[^>]*http-equiv=["']x-content-type-options["'][^>]*>/gi, '');
|
||||
|
||||
// Links umschreiben: Klicks im iframe laufen über unseren Proxy → Folge-Logs
|
||||
const protocol = req.protocol || 'http';
|
||||
const host = req.get('host') || 'localhost:3005';
|
||||
const proxyBase = `${protocol}://${host}/api/clicktt/proxy`;
|
||||
// URL aus .env (BACKEND_BASE_URL oder BASE_URL), Fallback: Request-Host
|
||||
const baseUrl = process.env.BACKEND_BASE_URL || process.env.BASE_URL
|
||||
|| `${req.protocol || 'http'}://${req.get('host') || 'localhost:' + (process.env.PORT || 3005)}`;
|
||||
const proxyBase = baseUrl.replace(/\/$/, '') + '/api/clicktt/proxy';
|
||||
html = rewriteLinksInHtml(html, proxyBase, targetUrl);
|
||||
|
||||
res.set({
|
||||
|
||||
Reference in New Issue
Block a user