Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_INVALID_REDIRECT when running http-server #525

Open
matpl opened this issue May 3, 2019 · 83 comments

Comments

@matpl
Copy link

commented May 3, 2019

Do you want to request a feature or report a bug?

If the issue is a bug report, please provide the steps to reproduce it. Please include the actual command causing the issue if applicable.

npm i -g http-server
http-server

Then open chrome at 127.0.0.1:8080

What did you expect to happen?

Open an empty page

What actually happened? Please include the actual error trace and / or stack trace if applicable.

ERR_INVALID_REDIRECT

If the issue is a feature request, what is the motivation / use case for it?

Tell us about your environment

  • http-server version:
    Tried 0.11 and also the master branch from the github repo
  • Platform:
    win10
@matpl

This comment has been minimized.

Copy link
Author

commented May 3, 2019

I feel it may be related to the ecstatic issue earlier today... Could it be possible that the updated version of ecstatic (3.3.2) isn't compatible with http-server?

@thornjad

This comment has been minimized.

Copy link
Member

commented May 3, 2019

What is in the directory you're serving? I'm not getting the same on my Mac

@matpl

This comment has been minimized.

Copy link
Author

commented May 3, 2019

I'm serving the current directory. I tried with an index.html with an empty body, but I still get ERR_INVALID_REDIRECT. I'm at work so it could possibly be a proxy issue or something. I can try again at home later today to see if I get the same behavior.

@captainturtle

This comment has been minimized.

Copy link

commented May 3, 2019

I have the same issue. I'm running http-server on Windows 10, and getting the same error. I updated http-server and ecstatic, but it didn't work. In my case I only have a single html page (index.html).

@thornjad

This comment has been minimized.

Copy link
Member

commented May 3, 2019

Just an idea, but do any of you see the same thing if you use npx http-server-legacy instead of http-server?

@matpl

This comment has been minimized.

Copy link
Author

commented May 3, 2019

I have the same issue with npx http-server-legacy. And I use http-server on a weekly basis I'd say, and I only had this error from a fresh install for http-server. So it was working fine with the latest version in the last weeks, and it stopped working after a clean install today (with the same version). That's why I suspect a dependency issue.

@gdurazzo

This comment has been minimized.

Copy link

commented May 3, 2019

i have the same issue, both http-server and http-server-legacy,
no solution so far

@captainturtle

This comment has been minimized.

Copy link

commented May 3, 2019

I think the issue is somehow related to directories.

When I enter http://localhost:8080, I get the same error, however requesting http://localhost:8080/index.html directly works.

A weird thing happens when I request a directory under the root. When I go to
http://localhost:8080/folder
it redirects me to this address:
http://localhost:8080/folder///////////////////
and produces this error:

This page isn’t working
localhost redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

@captainturtle

This comment has been minimized.

Copy link

commented May 3, 2019

Just an idea, but do any of you see the same thing if you use npx http-server-legacy instead of http-server?

I have tried npx http-server-legacy now, still giving the error.

@bspammer

This comment has been minimized.

Copy link

commented May 3, 2019

I'm having exactly the same error as @captainturtle on windows only. Seems to be working fine on OSX.

@captainturtle

This comment has been minimized.

Copy link

commented May 3, 2019

Possibly related to ecstatic issue as mentioned:

https://www.npmjs.com/advisories/830

@bspammer

This comment has been minimized.

Copy link

commented May 5, 2019

It's definitely ecstatic. I downgraded to 3.0.0 and the issue disappears.

@gdurazzo

This comment has been minimized.

Copy link

commented May 6, 2019

@bspammer I did the same and solved it too.

@SCLeoX

This comment has been minimized.

Copy link

commented May 6, 2019

Ahhh this is so annoying. Because of this ecstatic thing, I waited 2 days before my CI gets back up again. Now my dev server is broken.

@rendall

This comment has been minimized.

Copy link

commented May 15, 2019

Can confirm this bug still exists.

@mikeycooper

This comment has been minimized.

Copy link

commented May 15, 2019

Confirmed the issue is due to http-server being incompatible ecstatic 3.3.2. Updating http-server's package.json to require ecstatic 3.3.1 fixes http-server for me.

@leptest

This comment has been minimized.

Copy link

commented May 16, 2019

Getting the same issue.

@ford04

This comment has been minimized.

Copy link

commented May 16, 2019

Same here, exactly as @captainturtle described it.

@thornjad

This comment has been minimized.

Copy link
Member

commented May 16, 2019

This seems to be caused by jfhbrook/node-ecstatic#260, which is unlikely to ever be fixed. Is anyone seeing this on a non-Windows machine?

@tuxpedro

This comment has been minimized.

Copy link

commented May 16, 2019

This resolv my problem

PS C:\myapp> node --version
v12.2.0

PS C:\myapp> npm --version
6.9.0

PS C:\myapp> npm install -g http-server@0.9.0

@rafikiadmin

This comment has been minimized.

Copy link

commented May 16, 2019

Just confirmed - same problem and tuxpedro's solution worked for me on Windows (version 0.9.0 of http-server which uses a much earlier ecstatic it looks like). I tried forcing ecstatic to 3.3.1 like mikeycooper, but that did not work for me.

@aleksvatman

This comment has been minimized.

Copy link

commented May 17, 2019

Same issue. My http-server was using ecstatic 3.0.0 and it was not working. @tuxpedro solution worked

@humphd

This comment has been minimized.

Copy link

commented May 17, 2019

I've seen this happen to a dozen or so of my web students this week, and it only seems to be on Windows.

@humphd

This comment has been minimized.

Copy link

commented May 18, 2019

Follow-up from one of my students, who says that using http://localhost:8080 causes the bug, but explicitly using http://localhost:8080/index.html works.

@tlloydukdev

This comment has been minimized.

Copy link

commented May 18, 2019

Downgrading to http-server 0.9.0 fixed it for me under Windows

@phtwo

This comment has been minimized.

Copy link

commented May 20, 2019

Same issue on Windows.
Downgrading to 0.9.0 or explicitly using *.html worked

@blackr1234

This comment has been minimized.

Copy link

commented May 20, 2019

Same issue on Windows 10 Insider Preview 18890.
I fixed it by adding ecstatic 3.0.0 entry in package.json and then npm install.

@elainema

This comment has been minimized.

Copy link

commented May 20, 2019

Is there any solutions, I got the same issues,

@danielstern

This comment has been minimized.

Copy link

commented Jul 3, 2019

Better to just navigate to localhost:8080/index.html

@Hamdambek

This comment has been minimized.

Copy link

commented Jul 3, 2019

Better to just navigate to localhost:8080/index.html

@danielstern thank you for the reply,
Addition, I tested chrome --> to ---> Mozilla
Now is working well.

@TCarmine

This comment has been minimized.

Copy link

commented Jul 6, 2019

I had same issue with Ubuntu 18.04, with http-server-legacy kind of also fixed, but prefered thus one.

This indeed solved my issue, but still in dist is not produced any index.html

This resolve my problem

PS C:\myapp> node --version
v12.2.0

PS C:\myapp> npm --version
6.9.0

PS C:\myapp> npm install -g http-server@0.9.0

@mnjit20

This comment has been minimized.

Copy link

commented Jul 11, 2019

I have just installed the older version and it worked but it has a security vulnerability in this version,

If you are just using for some local development then it's fine.

First, uninstall the existing
npm uninstall -g http-server

Install version 0.9.0
npm install http-server@0.9.0

@Aswinpookkatt

This comment has been minimized.

Copy link

commented Jul 12, 2019

I have just installed the older version and it worked but it has a security vulnerability in this version,

If you are just using for some local development then it's fine.

First, uninstall the existing
npm uninstall -g http-server

Install version 0.9.0
npm install http-server@0.9.0

if so how to use latest version?

@wedinjoy

This comment has been minimized.

Copy link

commented Jul 14, 2019

in the folder path use the file name too and it work
like \project\index.html

@blackr1234

This comment has been minimized.

Copy link

commented Jul 14, 2019

in the folder path use the file name too and it work
like \project\index.html

Of course it will work. All web servers work this way.
The point is index.html is a magic file. It should be the default entry point if not specified.

@josebrandao

This comment has been minimized.

Copy link

commented Jul 15, 2019

On the cmd just type:

http-server [copy and paste the path of your project here] like:
http-server C:\Users\JOSE\Desktop\app
within the folder should have an index.html file at least.

@pwxyz

This comment has been minimized.

Copy link

commented Jul 15, 2019

This resolv my problem

PS C:\myapp> node --version
v12.2.0

PS C:\myapp> npm --version
6.9.0

PS C:\myapp> npm install -g http-server@0.9.0

npm install -g http-server@0.9.0 and it will work

@pedroomatoso

This comment has been minimized.

Copy link

commented Jul 21, 2019

downgrading to http-server 0.9.0 fixed my issue too

@maximfreerider

This comment has been minimized.

Copy link

commented Jul 22, 2019

I had tha same problem, and i used the Incognito Mode in Google Chrome, it`s working)))))))

@JinLingfeng

This comment has been minimized.

Copy link

commented Jul 23, 2019

This resolv my problem

PS C:\myapp> node --version
v12.2.0

PS C:\myapp> npm --version
6.9.0

PS C:\myapp> npm install -g http-server@0.9.0

It works well! Thank you

@bjornharrtell

This comment has been minimized.

Copy link

commented Aug 7, 2019

Looks like this is due to jfhbrook/node-ecstatic#260.

@Zaniyar

This comment has been minimized.

Copy link

commented Aug 7, 2019

If you're using nvm, just install another version of node and try again. It worked for me.

@KasunGamage

This comment has been minimized.

Copy link

commented Aug 10, 2019

I think the issue is somehow related to directories.

When I enter http://localhost:8080, I get the same error, however requesting http://localhost:8080/index.html directly works.

A weird thing happens when I request a directory under the root. When I go to
http://localhost:8080/folder
it redirects me to this address:
http://localhost:8080/folder///////////////////
and produces this error:

This page isn’t working
localhost redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

Thanks man. it works when i added /index.html.

@ronanogor

This comment has been minimized.

Copy link

commented Aug 12, 2019

To sump up : 2 work arounds :

  • adding /index.html which is not acceptable as solution
  • downgrading to V0.9.0 which is neither a good solution, since we're skiping the fixed issues since then

So : is there an upcomping V0.12 including this blocker ?

@vinay-akkipet

This comment has been minimized.

Copy link

commented Aug 17, 2019

Sum up of current workarounds here:

https://stackoverflow.com/a/57536943/567328

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
You can’t perform that action at this time.