Forum Discussion

rschwarz79's avatar
rschwarz79
Icon for Altocumulus rankAltocumulus
Oct 24, 2024

Uri Rewrite and relative Uri's/Links

Hello Folks,

 

I think it's more an theoretical question, but with a practical background.

 

I've the following secenario.

 

Client side is requesting "https://www.domain.com/app

Proxy performs a HTTP:uri rewrite from /app to "/"   (content on backend system is in the root directory).

That's working fine -> I'll get a Login mask and then I'll get some incomplete content back in the browser.

 

After looking the site source code I'll find a lot of "relative links"

<!DOCTYPE html>
 <html lang="en"><head><meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> 
<base href="/" />

<link href="css/rich-text/bundle.min.css" rel="stylesheet">
<link href="css/rich-text/css/dx.light.css" rel="stylesheet"> 
<link href="css/rich-text/bundle-richedit.min.css" rel="stylesheet">

<script src="_framework/blazor.webassembly.js"></script>
<script src="_content/MudBlazor/MudBlazor.min.js"></script>
<script src="_content/Dsm.Blazor.Components/common.bundle.js"></script>
<script src="_content/Dsm.Blazor.Components/contextmenu.bundle.js"></script>

and so on.

 

The problem is, the browser is requesting all these links without the subdirectory /app

https://www.domain.com/css/rich-text instead of https://www.domain.com/app/css/rich-text

 

A search on the WWW says that the usage of subfolders + rewrites with relative paths should not really be a problem. Or rather, this was described as a workaround.

According to my understanding of relative links, these should simply be added to the existing browser URL during the request.

 

Do I have a problem understanding relative links here or could be the <base href="/" /> the problem (because all paths are relative to / [root path] thus removing the /app path from subsequent requests)?

 

Thanks in advance for you help.

rschwarz

No RepliesBe the first to reply