3

Server for PixiJS not working, "localhost sent an invalid response" error when connecting for client side

When I try connecting to the server (http://127.0.0.1:8080) through my chrome browser, I get a page which has this written on it: "This page isn’t working localhost sent an invalid response. ERR_INVALID_REDIRECT" And it also downloads a file called "download" with it. I have no idea as to why this happens. This "download" file is almost the exact same as the code in my index.html file. The code is the following:

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Testing pixi.JS</title>
        <!--  The <script> tag's src should be relative to your root directory where your webserver is running -->
        <script src="pixi/pixi.min.js"></script>
    </head>


    <body>
        <script type="text/javascript">
            let type = "WebGL";
            if(!PIXI.utils.isWebGLSupported()){
                type = "canvas";
            }
        </script>
    </body>
</html>

<!-- MY INDEX.HTML CODE -->

<!DOCTYPE html>

<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Testing pixi.JS</title>
        <!--  The <script> tag's src should be relative to your root directory where your webserver is running -->
        <script src="./pixi.min.js"></script>
    </head>


    <body>
        <h1>Hello there!</h1>
        <script type="text/javascript">
            let type = "WebGL";
            if(!PIXI.utils.isWebGLSupported()){
                type = "canvas";
            }
        </script>
    </body>
</html>

CODE TYPED INTO CMD AFTER MOVING TO SAME FOLDER AS INDEX.HTML:

npm install http-server -g

http-server

I expected the page to load but it doesn't. I have no idea as to what to do.

user8380672
  • 520
  • 1
  • 9
  • 20

3 Answers3

8

If you navigate to the full path it seems to work: http://127.0.0.1:8080/index.html It seems to be some http-server bug.

There are many other local web servers. I suggest browsersync:

npm install -g browser-sync
browser-sync start --server --index index.html
Leftium
  • 16,497
  • 6
  • 64
  • 99
  • Thanks for the reply. I just managed to get Pixi.js to work using the express package. Thanks for the suggestion though, I'll use it as backup in case something happens to express. – user8380672 Jun 16 '19 at 13:47
5

There is a bug, it seems only affect to Windows. You should install a lower version of http-server, 0.9.0 works.

Run the following command

npm install -g http-server@0.9.0

for more info click here.

Saeed
  • 3,294
  • 5
  • 35
  • 52
Bhushan 206
  • 51
  • 1
  • 3
  • How does this contribute over and above the already accepted answer? – gstukelj Oct 18 '19 at 08:15
  • 1
    Thank you for leaving this answer. I'm on Windows and I'm running into some random issue getting browser-sync to work, so rolling http-server back to 0.9.0 was exactly what worked for me. Thanks again! – mklickman Nov 23 '19 at 14:02
0

I tried to connect to a netgear D700 using opera and edge but got the same response. Eventually I used the old 32bit internet explorer and got into the router. Once the firmware was updated I was able to use opera to get into the router.

Graham
  • 1