Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Redirecting to // - connect.static bug on Windows #427

alessioalex opened this Issue · 8 comments

7 participants


When using connect.static on Windows (with Express), when visiting http://localhost it will show you:

Redirecting to //

even though you have the '/' route defined. I managed to find a workaround for this by using 'redirect: false' as an option, but this is a bug as far as I can tell (on Linux I never got that).

Note: I did not have anything except a txt file in the public folder. (so no index.html there)

tj commented

thanks i'll add a test case for this in a bit and get it covered


Same problem here, but in my case, I have an index.html.
I investigated a bit, and the issue lies in this line:

if ('/' == path[path.length - 1]) path += 'index.html';

in lib/middleware/static.js.
Because node's path.join uses \ on windows, we'll need an check like this

var pathsep = process.platform === 'win32' ? '\\' : '/';
if (pathsep == path[path.length - 1]) path += 'index.html';

+1 on @andihit's fix.



if (normalize('/') == path[path.length - 1]) path += 'index.html';

Yes, this bug has been bothering me for months now.
+1 on @mojodna -s fix.

@tj tj closed this in b74a338
tj commented

sorry for the delay i've been sick, i'll push a new release


this is wrong... please adjust
if (normalize('/') == path[path.length - 1]) path += 'index.html';


if (normalize('/') == normalize(path[path.length - 1])) path += 'index.html';

broked all the frameworks who used this:


it fixed this bug on windows.


This fix works on all browsers for me except for Chrome.

Any ideas????

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.