File tree Expand file tree Collapse file tree
packages/remote-control-server/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,6 +18,6 @@ export const config = {
1818} as const ;
1919
2020export function getBaseUrl ( ) : string {
21- if ( config . baseUrl ) return config . baseUrl ;
22- return `http://localhost: ${ config . port } ` ;
21+ const url = config . baseUrl || `http://localhost: ${ config . port } ` ;
22+ return url . replace ( / \/ + $ / , "" ) ;
2323}
Original file line number Diff line number Diff line change @@ -33,6 +33,17 @@ const app = new Hono();
3333
3434// Middleware
3535app . use ( "*" , logger ( ) ) ;
36+ app . use ( "*" , async ( c , next ) => {
37+ // Normalize double slashes in path (e.g. //v1/environments/bridge → /v1/environments/bridge)
38+ const path = new URL ( c . req . url ) . pathname ;
39+ if ( path . includes ( "//" ) ) {
40+ const normalized = path . replace ( / \/ + / g, "/" ) ;
41+ const url = new URL ( c . req . url ) ;
42+ url . pathname = normalized ;
43+ return app . fetch ( new Request ( url . toString ( ) , c . req . raw ) ) ;
44+ }
45+ await next ( ) ;
46+ } ) ;
3647app . use ( "/web/*" , cors ( ) ) ;
3748
3849// Health check
You can’t perform that action at this time.
0 commit comments