2

I want to hide my gitweb instance behind a reverse proxy. So I set my base url to /gitweb but some URLs are still broken.

As I debugged the problem I found that the following stylesheet is loaded from /gitweb.css instead of /gitweb/gitweb.css.

<base href="/gitweb" />
<link rel="stylesheet" type="text/css" href="gitweb.css"/>

I've found a fix for this problem which says these links are interpreted as absolute urls. Unfortunately I'm not using Apache - which was used in the fix.

Anyway. I'm just wondering why href="gitweb.css" is not using the base href

Jan Turoň
  • 31,451
  • 23
  • 125
  • 169
boop
  • 7,413
  • 13
  • 50
  • 94

1 Answers1

3

He does, but the missing slash makes that the browser thinks "gitweb" is a page and only use the "/". Which is the same as base.

See: https://stackoverflow.com/a/1889957/4516689

Or the example in the spec: http://www.w3.org/TR/html5/document-metadata#the-base-element

<!DOCTYPE html>
<html>
    <head>
        <title>This is an example for the &lt;base&gt; element</title>
        <base href="http://www.example.com/news/index.html">
    </head>
    <body>
        <p>Visit the <a href="archives.html">archives</a>.</p>
    </body>
</html>

The link in the above example would be a link to "http://www.example.com/news/archives.html".

Community
  • 1
  • 1
Markus
  • 3,871
  • 3
  • 23
  • 26