ngrok doesn't work in some particular case - python

I'm tunneling with ngrok to access my localhost of remote desktop.
I successfully created my forwarding URL with ngrok but it doesn't seem it works well.
Let's say when I do this https://*******.ngrok.io/sentiment/楽 I get what I want.
But when I do this https://*******.ngrok.io/sentiment/楽しい I get bad request error but the url actually perfectly returns output on localhost of remote desktop.
I don't know what's just different, is there any encoding problem or something? I'm so in trouble. thanks.

Related

Dash App not working when deployed on Amazon EC2 instance

I am new to linux/aws in general and I am trying to deploy a dash webapp onto an ec2 instance. The webapp is written in python and uses an aws database. I created an EC2 instance, set the security group to allow all traffic, uses the default VPC and internet gateway. I successfully installed the all the app dependencies but anytime I run the app.py file. The public dns doesnt load the webpage. I have tried pinging the public IP and that works. I really have a limited knowledge base hear and have tried different options but cant seem to get it working. Please help :)
Public IP-https://ec2-3-8-100-74.eu-west-2.compute.amazonaws.com/
security group
webapp
I've been smacking my head on this for a couple days and finally got it. I know it's been a while but hopefully this helps someone else. Had a hard time finding answers elsewhere. Very similar to you, I had the ec2 instance set up, the security groups and vpc set up (those steps aren't too difficult and are well-documented). I had some successful pings, but was getting a "connection refused" error through the browser.
The "app.run_server()" parameters were the missing piece for me:
if __name__ == '__main__':
app.run_server(host= '0.0.0.0',port=80)
At that point calling the .py app gave me a 'permission denied,' which I was able to get around by running as sudo ("sudo python3 my_app.py") -- and by sudo pip install-ing necessary packages. (All through ssh, fwiw).
After finally running successfully I was given an IP from the dash app corresponding to my private IPv4 on EC2, and at that point could set my browser to the PUBLIC IPv4 and get to the app. Huzzah.
Playing around with it a little, it looks like as long as you have:
host= '0.0.0.0'
you'll run it online. Without that, it runs only locally (you'll see IP as 127.0.0.1). Then it's a matter of making sure whatever port you're using (:80, :443, :8050) is open according to firewalls and security groups. Dash for me defaults to :8050, and that port might be fine as long as it's allowed through security groups.
QUICK UPDATE:
I tried leaving it on port :8050, and also opened :8050 to all ipv4 in my security group. That let me run everything successfully without using "sudo python3".
if __name__ == '__main__':
app.run_server(host= '0.0.0.0',port=80)
With "python3 my_app.py" in ssh

Django tutorial: problems accessing development server

I am going through the Django tutorial and am running into problems when trying to view my webpage. I am at the very beginning of the tutorial when I first run the command python manage.py runserver xxx.xxx.xxx.xxx:8000 (replace the x's with my remote server's IP). When I try to navigate to http://xxx.xxx.xxx.xxx:8000 on my local machine, Chrome gives me the error ERR_CONNECTION_REFUSED. I have also tried running the server on 0.0.0.0:8000 and the same issue persists. The port is definitely open and there are no firewalls blocking it - when I plug in my IP and 8000 into this site it claims it is open: http://ping.eu/port-chk/.
I get no error messages on my console from the Django side of things. What could be causing this error? I really don't know much about servers or ports. Thanks in advance.
I am on a virtual Linux server running CentOS 6.4. My local machine is running Mac OS 10.9.5
EDIT:
When I run netstat --listen, port 8000 doesn't show up in the Local Address column, even though my Django dev server claims to be running. Someone mentioned to me that this means my application is not listening on this port. What does this mean and how do I remedy it?
EDIT:
I can access the page through my phone's internet with no issues. What gives?
If you're running Django inside a VM but accessing it from the host Mac, you'll need to forward the port. See the settings in Virtualbox/VMWare/whatever.
Note however that Django runs perfectly well directly on a Mac, so if you're just learning it may be simpler to just install it there.
Don't issue no IP, runserver will tell you where you can connect to when launching it.
Since you're launching it from your VM, you might supply the IP.
Ensure system level routing is okay.
Add your host local IP to the ALLOWED_HOSTS setting.

Troubles with http server on linux

I have such problem. I have local http server (BottlePy or Django), and when i use http:// localhost/ or http:// 127.0.0.1/ - it loads immediately. But when i use my local ip (192.168.1.100), it loads very long time (some minutes). What could be the problem?
Server works on Ubuntu 11.
you should take a look at
Slow Python HTTP server on localhost
similar issues has been resolved there.
It looks like that you have problems with DNS. can you check this idea running host 192.168.1.100 on the host? Please also check that other DNS queries being quickly processed.
Check /etc/hosts file for a quick-and-dirty solution.

Quick issue with Python 3.1 http server

I'm have an issue with running the built in Python server that comes with 3.1, this may or may not be an issue with Python, in fact it probably isn't.
I start my server in the correct directory with "python -m http.server 8000" as the documentation suggests (http://docs.python.org/release/3.1.3/library/http.server.html).
When I navigate to that port on my local network with another computer using the url 192.168.2.104:8000 (my local ip and the port) my page loads. When I use my global IP, however, it stops working. Port 8000 is forwarded correctly. I used www.yougetsignal.com to verify that port 8000 was open using my global IP. Why in the world would Chrome be saying "Oops! Google Chrome could not connect to [REDACTED]:8000" then? Other server applications (such as my Minecraft server) work just fine. Is there something I'm missing? Furthermore, why would yougetsignal connect to my port but not Chrome?
With most routers ports are only mapped when someone connects from the outside (internet/WAN). You're testing it from your LAN so basically you're connecting to your router when you use your public IP. Ask a friend to test, i.e. from an outside connection.

URLError: urlopen error timed out

Whenever i try to make a HTTP request to some url through my django application which is running on top of apache mod_python (Machine: Ubuntu 10.04 server edition, 64-bits), it gives a timeout error.
The strange thing is that it works fine on Ubuntu 10.04 server edition, 32-bits.
I feel there could be some proxy connection issue. But i am not sure how to resolve it, if that is the case.
What could be the issue? Can anyone please throw some light on this.
Thanks in Advance.
Run simple network analysis first,
tracert
ping
wireshark (for network analysis)
Check your firewall and proxy settings on the server and make sure the correct ports, routes and permissions are fine.
Step 1:
Try it in the python shell first. Just take whatever you're trying to do with urlopen and do it in the python shell. You need to simplify your test.
Step 2:
If it still doesn't work maybe it's network... trying pinging the domain.
# ping domain.com
Could be a DNS issue, try looking the domain up:
# nslookup domain.com
or
# dig domain.com
If this works try pinging the IP directly.
# ping 000.000.000.000
Without more details this is all I know to try.

Categories