My ngrok Tunne Status shows reconnecting running on a custom port (4901) - flask

I am running a ngrok on 4901 port.
I am also running a flask webserver on the same port. The idea is that I want to access my local webserver from outside world to do some app testing.
What am I missing ?
NGROK running on 4901
./ngrok 4901
ngrok
Tunnel Status reconnecting Version
1.7/ Web Interface 127.0.0.1:4040
# Conn 0 Avg Conn Time 0.00ms
FLASK:
python webserver.py
* Running on http://0.0.0.0:4901/
127.0.0.1 - - [01/Jul/2016 15:16:02] "GET / HTTP/1.1" 200 -

You are using ngrok version 1.7, which has now been shut down completely. Quoting from their announcement:
As of April 4, 2016, all 1.X sessions were no longer be and service ended completely.
You should be able to upgrade to version 2.0+ and keep using it, although I haven't tried it yet myself.

Related

Django remote server is running but I cannot connect to admin interface in local web browser

So I have set up my Django server through an SSH connection to my remote server. It shows me that the server is actually running:
August 10, 2020 - 04:09:47
Django version 3.1, using settings 'risk_areas.settings'
Starting development server at http://xx.xxx.xxx.xxx:8000/
Quit the server with CONTROL-C
However, if I try to go to the URL above (with my IP address in it) it gives me a connection time out error. What might be the reason for this?

localhost:8000 working but mywebsite:8000 with etc/hosts modified doesn't work

Everything is in the title: I'm launching my webserver (Django / Python) on port 8000.
/home/olivier/my_venv3.8/bin/python3 /home/olivier/pycharm-2018.1.3/plugins/python/helpers/pydev/pydevd.py --multiproc --qt-support=auto --client 127.0.0.1 --port 40761 --file /home/olivier/projects/evalr/manage.py runserver 8000
pydev debugger: process 5923 is connecting
Connected to pydev debugger (build 193.5662.61)
http://evalr.hqf.fr:8000/fr/assistant/
http://evalr.hqf.fr:8000/fr/sessions/
pydev debugger: process 5935 is connecting
http://evalr.hqf.fr:8000/fr/assistant/
http://evalr.hqf.fr:8000/fr/sessions/
Watching for file changes with StatReloader
Performing system checks...
I've added in my /etc/hosts this line : 127.0.1.1 evalr.hqf.fr and when I ping it, it correctly shows "127.0.0.1"
When I try go on http://evalr.hqf.fr:8000 I get connection refused and when I try to go on http:/localhost:8000 it works.
The problem is that when I try to go on http://evalr.hqf.fr:8000 I dont have any trace on the server side, i.e. it stays here:
System check identified no issues (0 silenced).
January 03, 2020 - 20:41:31
Django version 3.0.2, using settings 'evalr.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
And when I go on http://127.0.0.1:8000/ I get a log of every single access like:
[03/Jan/2020 20:47:42] "GET /fr/sessions/ HTTP/1.1" 302 0
[03/Jan/2020 20:47:42] "GET /fr/login/?next=/fr/sessions/ HTTP/1.1" 200 7031
[03/Jan/2020 20:47:43] "GET /static/vendors/css/all.min.css HTTP/1.1" 200 54456
................ blabla............;
[03/Jan/2020 20:47:43] "GET /favicon.ico HTTP/1.1" 301 0
I've even tried to reboot (even though I'm on Linux, which talks by itself - no reboot needed), so I'm stuck because everything should work fine. What am I missing?
That is because in /etc/hosts it should be 127.0.0.1 instead
Also check the ALLOWED_HOSTS and you could try running it with: python manage.py runserver 0.0.0.0:8000
The fact that you get a connection refused when using the hostname, and do not see any logging from your application, makes me think that you are dealing with DNS caching. My favorite way to test this is using curl, since it can show you both the IP address and response of an HTTP request. Try the following command:
curl -Iv -X GET http://evalr.hqf.fr:8000
Did it resolve to 127.0.0.1? If so, did you get a response? If so, did you see logs in your application?
If the answer to these question is yes, then try to clear the DNS and browser cache.

ngrok doesn't lift my local django web server

I have problems with negrok, it does not raise my local django web server, a few days ago everything worked correctly but a normal day, without having touched anything, it stopped working.
Run the following:
python manage.py runserver
Everything works normally and correctly.
Now I execute the following, in order to raise the local django server:
./ngrok http 8000
ngrok runs correctly without any problem but when accessing the ngrok link, the page is loading and everything is blank and does not work ....
This appears in ngrok:
ngrok by #inconshreveable (Ctrl+C to quit)
Session Status online
Account Julio (Plan: Free)
Version 2.3.34
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://33822c5a.ngrok.io -> http://localhost:8000
Forwarding https://33822c5a.ngrok.io -> http://localhost:8000
Connections ttl opn rt1 rt5 p50 p90
2 0 0.03 0.01 0.20 0.21
HTTP Requests
-------------
GET / 400 Bad Request
GET / 400 Bad Request
And this appears in django:
Watching for file changes with StatReloader
Performing system checks...
System check identified no issues (0 silenced).
September 25, 2019 - 17:23:19
Django version 2.2.2, using settings 'ibme_proyect.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Invalid HTTP_HOST header: '33822c5a.ngrok.io'. You may need to add '33822c5a.ngrok.io' to ALLOWED_HOSTS.
Bad Request: /
[25/Sep/2019 17:25:30] "GET / HTTP/1.1" 400 68119
Invalid HTTP_HOST header: '33822c5a.ngrok.io'. You may need to add '33822c5a.ngrok.io' to ALLOWED_HOSTS.
Bad Request: /
[25/Sep/2019 17:25:38] "GET / HTTP/1.1" 400 68254
I add the ngrok host (33822c5a.ngrok.io) in ALLOWED_HOSTS and stop giving django error, and access the ngrok link and I know that it loads again, it doesn't load the HTML, nothing, everything blank ...
Any solution? :(
try
ALLOWED_HOSTS = ["*"]
this will allow tunneling every ngrok run :)

Unable to view django website - development server

Upon running the the dev server 0.0.0.0:8000, I cannot see the website loaded in the browser.
While going through some of the reasons why this might happen, I have done the following changes:
ALLOWED_HOSTS = ['*']
Killed all processes on 8000
firewall turned off
The server I am working on is RHEL.
System check identified no issues (0 silenced).
April 01, 2019 - 04:39:38
Django version 2.1.7, using settings 'gig_bank.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CONTROL-C.
//Nothing is displayed in the browser.
Since you specified that it's a remote server, it most likely be a firewall issue,
you need to make sure port 8000 is open, you could test it using netcat as following :
nc -zv -w1 ip port
if the server is inside a cloud you need to add the rule to your cloud console, turning off the firewall in the server won't suffice.
Just in case the firewall on the server wasn't actually off, you could run sudo ufw allow 8000/tcp (For linux user)

Django runserver shows HTTP

I have configured nginx to run HTTPS. I also rewrite all the rules so it's running under HTTPS.
But is it true that Django still runs with HTTP internally?
Django version 1.2.1, using settings 'myproject.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[14/Aug/2012 23:57:04] "GET /app/c HTTP/1.0" 200 4
[14/Aug/2012 23:57:09] "GET /app/c HTTP/1.0" 200 4
Yes. I know my version is way way way outdated.
I checked request.is_secure and it returns True as I am accessing HTTPS.
Correct, internally you will use http to communicate through your proxy server but all your external traffic will use the https method.
To further secure your traffic ensure that you only bind to a local address, or alternatively use a socket to connect between nginx and your application server.
I do hope that you're not using django's development server in production, you should instead use something like gunicorn as your application server.