Pranay Chopra
Pranay Chopra

Reputation: 419

how do I fix ngrok invalid HTTP response error

I am using zphisher. when i create a link to ngrok, the link is generated, but on opening it it says ngrok gateway error The server returned an invalid or incomplete HTTP response. I got to know from ngrok error documentation that it is error 3004. they tell the error code and message but no possible way to fix the error. can someone help me please. I think my brother watches YouTube during his online classes and I want to conform it. No phishing. Please. I got absolutely no help from anywhere. Just one of my friend told me that i need an ngrok account for that. tried it, doesn't work.

Upvotes: 30

Views: 64291

Answers (7)

Mary
Mary

Reputation: 724

If your site using https://localhost:port below really works for me

ngrok http https://localhost:port --host-header=rewrite

and if you're working using the yml file:

authtoken: YOUR_AUTH_TOKEN
tunnels:
  frontend:
    proto: http
    addr: https://127.0.0.1:3002
    host_header: rewrite

Upvotes: 30

lotvx
lotvx

Reputation: 11

error message: "loaded over HTTPS, but requested an insecure XMLHttpRequest endpoint 'http://11111.ngrok-free.app/'. This request has been blocked; the content must be served over HTTPS."

I had the same problem with ngrok, my site was in https but all the inner requests were changed to http so for it to work I have changed the code in EasyAdmin Bundle , the file in in /vendor/easycorp/easyadmin-bundle/src/router/AdminUrlGenerator.php in line 267 after "$this->isInitialized = false;" we have to add the line $url = str_replace("http","https",$url);

and now it works for me.

Upvotes: 1

mohammad_coder
mohammad_coder

Reputation: 1

my solution is using this command:

ngrok http "http://$(ip route get 1.2.3.4 | awk '{print $7}')"

your httpd.conf must listen to port 80 or you must add it in the command. my OS is arch linux.

Upvotes: 0

Sumit Vadhera
Sumit Vadhera

Reputation: 21

The solution is pretty straightforward. Use the localhost:port where your application is running. For example, my Jenkins app is running on

http://localhost:8080

I will run the command $ngrok http http://localhost:8080

Notice the http/https difference

Upvotes: 1

cerebrum
cerebrum

Reputation: 51

I found an answer in this link and it solved my problem.

According to this you can use this command instead:

ngrok http https://localhost:[port]

Upvotes: 5

Mike Dubs
Mike Dubs

Reputation: 729

For me, this command worked when I was receiving the 3004 error message and trying to access HTTPS on https://localhost:3000:

./ngrok http https://localhost:3000

Upvotes: 16

Leonel waisblatt
Leonel waisblatt

Reputation: 261

After some time I got it fixed doing 2 things:

  1. Make sure my local site is http (not https)
  2. Running command ngrok http -host-header=rewrite localhost:PORT

Upvotes: 26

Related Questions