how do I fix ngrok invalid HTTP response error
Asked Answered
I

7

26

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.

Illtempered answered 20/7, 2021 at 18:4 Comment(0)
A
26

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
Abstergent answered 10/9, 2021 at 22:21 Comment(1)
As others have stated, you can host a local https site by using the full address instead of just the port: ngrok http https://localhost:8433Junji
T
23

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
Teetotal answered 11/8, 2022 at 12:35 Comment(3)
Tried all kind of syntaxes, but appending --host-header=rewrite was the solution.Mudcat
Excelent, TCP tunnel is funtionalSpot
--host-header=rewrite is the missing argument, thanks @TeetotalPenmanship
P
14

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
Plantation answered 11/11, 2021 at 2:27 Comment(2)
similarly, mind needed ngrok http https://localhost:5001 -host-header="localhost:5001" (as opposed to microsoft docs which suggests only ngrok http -host-header=localhost 5001 was needed)Reduplicate
you can use -host-header rewrite for this as well.Junji
T
5

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]
Tallia answered 16/2, 2022 at 7:24 Comment(0)
S
1

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.

Systemic answered 25/8, 2023 at 7:11 Comment(0)
M
0

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

Montcalm answered 6/5, 2023 at 11:37 Comment(0)
M
0

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.

Mediacy answered 13/8, 2023 at 13:12 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.