No response while using ngrok to expose a local web server - iis-express

I'm trying to expose my local web server IIS Express using ngrok.
Followed steps from https://ngrok.com/docs and fired the tunnel, but can't get response.
Screenshot - ngrok fired
I'm using Visual studio via IIS Express. (Debug mode, local website works well.)
If local website not started, access to XXXXX.eu.ngrok.io will get error directly:
Failed to complete tunnel connection
The connection to https://2713343d.eu.ngrok.io was successfully tunneled to your ngrok client, but the client failed to establish a connection to the local address localhost:44320.Make sure that a web service is running on localhost:44320 and that it is a valid address.The error encountered was: dial tcp [::1]:44320: connectex: No connection could be made because the target machine actively refused it.
No errors shows on Ngrok's Web Interface too.
Is there any way to check where the problems are? or see ngrok's log?

Indeed it works with http, but it is strongly recommended to work with https, so you should properly start ngrok in order to work with https:
ngrok http -host-header=localhost https://localhost:{your_IIS_express_port}
After this you should be able to access your URL:
https://{id}.ngrok.io
Credits

Try make your service as http, not https.

Related

Failed to listen on 127.0.0.1:443 (reason: Permission denied) [duplicate]

This question already has answers here:
OSX: Failed to listen on localhost:80 (reason: Permission denied)
(4 answers)
Closed last year.
hope you are all good,
I 'am working on a react native app for android, and i need data from my laravel API, the route works fine when i test it with Postman but on my mobile app i got an Error : Network Error.
I have been told that is because i need to put my laravel project on https so i tried
php artisan serve --port=443
but i got this error
Failed to listen on 127.0.0.1:443 (reason: Permission denied).
i'am really stuck and i don't know where the problem is...
Thank you all for you help mates
You've got a bunch of misconceptions interacting with each other here.
Misconception: Running on port 443 will give you HTTPS
Your attempted solution is to make your server listen on port 443, which is the default port for HTTPS.
It is failing because you are running the server as a user that doesn't have permission to listen on that port.
While you could solve that by running with admin privileges, that will just mean you are running an HTTP server on the default HTTPS port. Anything connecting to https://127.0.0.1/ will get an error because it will try to establish an encrypted connection and the HTTP server will be confused.
As far as I can tell, Artisan doesn't support HTTPS directly and you have to use a proxy server instead.
If you were to go down that route, then you could run both Artisan and the HTTPS proxy on any port. You can port a port number in an https:// URL just as you can with an http:// URL.
Misconception: You need HTTPS
You're getting a Network Error error when you try to connect from the mobile app.
While there are some things which require HTTPS, just loading a web page isn't one of them, and the things that do generally are quite explicit about requiring HTTPS in their error logs.
The real cause is most likely because the server is listening on 127.0.0.1 — localhost. It isn't accessible from a different computer.
Solutions
Listen on a different Network interface
You can listen on a non-privileged port on a LAN-facing IP address and then any device on your LAN can connect to it.
php artisan serve --host 192.168.1.101 --port 8000
Make sure you replace the host with an IP address belonging to your computer!
Use a proxy
A service like ngrok will expose your local (listening only on localhost) service on the public Internet (tunneling through any NAT on your router if needed) making it accessible to just about any device.
It can wrap it in HTTPS at the same time if you like.

Secure communication on tclhttpd server fails

I have a tclhttpd server and I am trying to communicate it using secure server (SSL). When I start my server, I get a notification that:
httpd started on port xxxx
secure httpd started on SSL port yyyy
When I try to access the normal HTTP (http://localhost:xxxx), I can access the web folder. However, when I am trying to access the web server through a browser using secure port and https (https://localhost:yyyy) it shows:
The connection to localhost was interrupted while the page was loading.
I've also used the Httpd_SecureServer call to initialize the server but i still cannot connect using ssl.
What am I doing wrong here? any ideas?

Ngrok setup an SSL local tunnel to an existing Vhost

I'm trying t use Ngrok to create a local tunnel to an SSL Virtual host I have on my local machine, but can't seem to get it to work.
My Vhost works perfectly. The site is https://local.mysite.com
Any of the command I try to use to predefine the pointing url on Ngrok, e.g.
./ngrok http -host-header=rewrite local.mysite.com:443
or
./ngrok http -subdomain=local.mysite.com local.mysite.com:443
always seems to return:
Bad Request
Your browser sent a request that this server could not understand.
Reason: You're speaking plain HTTP to an SSL-enabled server port.
Instead use the HTTPS scheme to access this URL, please.
I get that this is happening because I am trying to access a HTTPS connection via a HTTP call but I can't see alternatives in the ngrok docs.
https://ngrok.com/docs#expose
You need to use tls which is only available in the pro subscription.
If you use Vagrant, you can use the share function which is free and support https.

Charles debugging proxy not connecting to localhost

Charles Web Debugging Proxy not connecting to localhost. It was working right after I installed, but all of a sudden get connection refused, when trying to connect to localhost. Other traffic is going through proxy ok. The web server and proxy ports are different. *.8888 proxy listening on all addresses.
Get the following error
Charles Error Report
Failed to connect to remote host
Charles failed to connect to the remote host. Check that your Internet
connection is ok and that the remote host is accessible. Maybe your
network uses a proxy server to access the Internet? You can configure
Charles to use an external proxy server in the External Proxy
Settings.
The actual exception reported was:
java.net.ConnectException: Connection refused Charles Proxy,
http://www.charlesproxy.com/
Did you use PHP Built-in server?
The FAQs of office document say:
Localhost traffic doesn't appear in Charles
Some systems are hard coded to not use proxies for localhost traffic, so when you connect to http://localhost/ it doesn't show up in Charles.
The workaround is to connect to http://localhost.charlesproxy.com/ instead. This points to the IP address 127.0.0.1, so it should work identically to localhost, but with the advantage that it will go through Charles. This will work whether or not Charles is running or you're using Charles. If you use a different port, such as 8080, just add that as you usually would, e.g. localhost.charlesproxy.com:8080.
You can also put anything in front of that domain, e.g. myapp.localhost.charlesproxy.com, which will also always resolve to 127.0.0.1.
Alternatively you can try adding a '.' after localhost, or replace localhost with the name of your machine, or use your local link IP address (eg. 192.168.1.2).
If Charles is running and you're using Charles as your proxy, you can also use local.charles as an alternative for localhost. Note that this only works when you're using Charles as your proxy, so the above approaches are preferred, unless you specifically want requests to fail if not using Charles.
If you use php built-in server use
php -S 127.0.0.1:8080 -t ./public
instead of
php -S localhost:8080 -t ./public

Connect to Visual Studio server from remote machine using Fiddler and HTTPS

I am trying to connect to a Visual Studio server from a remote machine using Fiddler and HTTPS. I followed this tutorial (http://docs.telerik.com/fiddler/Configure-Fiddler/Tasks/UseFiddlerAsReverseProxy) which works perfectly for HTTP. When I moved my project to HTTPS, the connection stopped working. I have tried several solutions, including:
Proxying HTTPS traffic through Fiddler fails for remote clients?
http://lifelongprogrammer.blogspot.com.au/2014/04/using-fiddler-as-https-reverse-proxy.html
but haven't been able to get it to work. Can someone help?
You haven't explained what happens, but my guess is that your client is trying to do a HTTPS handshake with Fiddler, which is expecting HTTP because you didn't tell it to do anything else.
In Fiddler's QuickExec box, type
!listen 444 FiddlerMachineName
This will create a new HTTPS-accepting endpoint running at https://FiddlerMachineName:444 and Fiddler will perform a HTTPS handshake on all inbound connections. You can then use FiddlerScript to forward requests to the target service.

Resources