Skip to content

fix: add missing script_name prefix to hardcoded URLs in templates#1065

Open
torbenbrodt wants to merge 1 commit intoprebid:mainfrom
affinity-com:fix/add-missing-script-name-prefix-to-hardcoded-urls-in-templ
Open

fix: add missing script_name prefix to hardcoded URLs in templates#1065
torbenbrodt wants to merge 1 commit intoprebid:mainfrom
affinity-com:fix/add-missing-script-name-prefix-to-hardcoded-urls-in-templ

Conversation

@torbenbrodt
Copy link

Summary

Fix AGENTS.md pattern #6 violations across 13 templates where /tenant/... URLs were hardcoded without the {{ script_name }} prefix, causing 404s in path-prefix proxy deployments (nginx at /admin).

Problem

When the sales agent is deployed behind a reverse proxy at a sub-path (e.g., nginx serving the app at /admin), all hardcoded /tenant/... URLs in templates were missing the {{ script_name }} prefix. This caused 404 errors for form actions, anchor hrefs, JavaScript window.location assignments, and fetch() calls — any navigation or API call that used a literal path instead of the template variable.

Fix

Replaced all hardcoded /tenant/... paths with {{ script_name }}/tenant/... equivalents. For JavaScript contexts where the Jinja variable isn't directly available, a scriptName JS variable was introduced (e.g., in orders_browser.html) and used in template literals.

Before:

<form action="/tenant/settings">
<a href="/tenant/products">
window.location = '/tenant/dashboard';
fetch('/tenant/inventory')

After:

<form action="{{ script_name }}/tenant/settings">
<a href="{{ script_name }}/tenant/products">
window.location = '{{ script_name }}/tenant/dashboard';
const scriptName = '{{ script_name }}'; fetch(`${scriptName}/tenant/inventory`)

Files Changed

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

All contributors have agreed to the IPR Policy. Thank you!
Posted by the CLA Assistant Lite bot.

@torbenbrodt torbenbrodt force-pushed the fix/add-missing-script-name-prefix-to-hardcoded-urls-in-templ branch from f5b8db3 to 560f3d3 Compare February 25, 2026 07:53
Fix AGENTS.md pattern prebid#6 violations across 13 templates where
/tenant/... URLs were hardcoded without the {{ script_name }} prefix,
causing 404s in path-prefix proxy deployments (nginx at /admin).

Affected templates:
- tenant_settings.html (10 form actions and links)
- product_inventory_config.html (3 hrefs + 2 JS window.location)
- media_buy_approval.html (4 form actions and links)
- policy_review.html, policy_rules.html, policy_settings.html,
  policy_settings_comprehensive.html (breadcrumbs, forms, links)
- inventory_browser.html (2 JS fetch URLs)
- orders_browser.html (added scriptName JS var + 1 template literal)
- tenant_dashboard.html (1 JS window.location)
- edit_product_mock.html, workflows.html, signup_complete.html
@torbenbrodt torbenbrodt force-pushed the fix/add-missing-script-name-prefix-to-hardcoded-urls-in-templ branch from 560f3d3 to 6ca8bfe Compare February 27, 2026 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant