OptimalBits / redbird

A modern reverse proxy for node
BSD 2-Clause "Simplified" License
4.41k stars 280 forks source link

Absolute paths are broken #125

Open Bowserinator opened 7 years ago

Bowserinator commented 7 years ago

Suppose I had a server running on port 50 serving the file index.html: <a href="/something.html">Broken link</a>

In redbird I setup var proxy = require('redbird')({port: 80, xfwd: false}); proxy.register("example.com/test", "127.0.0.1:50"); When I access example.com/test, it redirects correctly to index.html. But when you click on the link it directs you to example.com/something.html, not example.com/test/something.html

justlep commented 7 years ago

There's no issue here. Your link's href starts with a slash, so it's relative to the root of the domain.

MartinMuzatko commented 6 years ago

It is a mixed problem of redbird and the browser. Redbird should be able to set up a trailing slash, otherwise the browser interprets it as a file, not a folder.

Thus, this also makes loading additional resources impossible. E.g.: example.com/test should redirect to example.com/test/ so path resolving is done correctly.