@@ -65,15 +65,13 @@ func TestRegisterStaticHandler(t *testing.T) {
6565 archiveStorage bool // archive storage enabled?
6666 metricsStorage bool // metrics storage enabled?
6767 logAccess bool
68- expectedBaseHTML string // substring to match in the home page
6968 UIConfigPath string // path to UI config
7069 expectedUIConfig string // expected UI config
7170 expectedStorageCapabilities string // expected storage capabilities
7271 }{
7372 {
7473 basePath : "" ,
7574 baseURL : "/" ,
76- expectedBaseHTML : `<base href="/"` ,
7775 archiveStorage : false ,
7876 logAccess : true ,
7977 UIConfigPath : "" ,
@@ -84,15 +82,13 @@ func TestRegisterStaticHandler(t *testing.T) {
8482 basePath : "/" ,
8583 baseURL : "/" ,
8684 archiveStorage : false ,
87- expectedBaseHTML : `<base href="/"` ,
8885 UIConfigPath : "fixture/ui-config.json" ,
8986 expectedUIConfig : `JAEGER_CONFIG = {"x":"y"};` ,
9087 expectedStorageCapabilities : `JAEGER_STORAGE_CAPABILITIES = {"archiveStorage":false,"metricsStorage":false};` ,
9188 },
9289 {
9390 basePath : "/jaeger" ,
9491 baseURL : "/jaeger/" ,
95- expectedBaseHTML : `<base href="/jaeger/"` ,
9692 subroute : true ,
9793 archiveStorage : true ,
9894 UIConfigPath : "fixture/ui-config.js" ,
@@ -102,7 +98,6 @@ func TestRegisterStaticHandler(t *testing.T) {
10298 {
10399 basePath : "/metrics" ,
104100 baseURL : "/metrics/" ,
105- expectedBaseHTML : `<base href="/metrics/"` ,
106101 subroute : true ,
107102 metricsStorage : true ,
108103 UIConfigPath : "fixture/ui-config.js" ,
@@ -149,7 +144,12 @@ func TestRegisterStaticHandler(t *testing.T) {
149144 assert .Contains (t , html , testCase .expectedUIConfig , "actual: %v" , html )
150145 assert .Contains (t , html , testCase .expectedStorageCapabilities , "actual: %v" , html )
151146 assert .Contains (t , html , `JAEGER_VERSION = {"gitCommit":"","gitVersion":"dev","buildDate":""};` , "actual: %v" , html )
152- assert .Contains (t , html , testCase .expectedBaseHTML , "actual: %v" , html )
147+ // Verify the inline base-path script marker is present and the backend
148+ // did not rewrite <base href> to a path-specific value (ADR-009).
149+ assert .Contains (t , html , `data-inject-target="BASE_URL"` , "<base> tag must carry data-inject-target marker for client-side base-path detection" )
150+ if testCase .basePath != "" && testCase .basePath != "/" {
151+ assert .NotContains (t , html , `<base href="` + testCase .baseURL + `"` , "backend must not inject path-specific <base href>" )
152+ }
153153
154154 asset := httpGet ("static/asset.txt" )
155155 assert .Contains (t , asset , "some asset" , "actual: %v" , asset )
@@ -170,17 +170,6 @@ func TestNewStaticAssetsHandlerErrors(t *testing.T) {
170170 Logger : zap .NewNop (),
171171 })
172172 require .Error (t , err )
173-
174- for _ , base := range []string {"x" , "x/" , "/x/" } {
175- _ , err := NewStaticAssetsHandler ("fixture" , StaticAssetsHandlerOptions {
176- UIConfig : UIConfig {
177- ConfigFile : "fixture/ui-config.json" ,
178- },
179- BasePath : base ,
180- Logger : zap .NewNop (),
181- })
182- assert .ErrorContainsf (t , err , "invalid base path" , "basePath=%s" , base )
183- }
184173}
185174
186175func TestHotReloadUIConfig (t * testing.T ) {
0 commit comments