We have two tornado/webssh servers and we're using a loadbalancer to distribute the traffic
the loadbalancer works fine with https since it depends on the cookie but in https mode the webssh sessions not working and it's because the loadbalancer depends on the sessionid for persistence and tornado doesn't support sessions , there is another option in the loadbalancer to use ip source but we can't depend on that since the users are using a proxy and the ip changes
do you guys know how to solve this issue ?
thanks in advance
Related
In my python project I have to track user IP address and country and region, and other information, I used "https://ipapi.co/json/" for tracking the IP address, but thing is when i deploy my model(web-app) on the deployment website, it is giving me that server IP address instead who is using my web-app. when i try in my local machine it is giving my IP address. Actually, i am currently new and don't know that much about tracking IP another.
Please anyone can describe how i will achieve this thing. how to track the user of my web-app IP address instead of the deployment server IP address.
Ref- I am using streamlit sharing for the deployment it is giving me streamlit office address instead of my friend(test user) IP. I need my fried IP address when he is using the deployed web app.
Thank you sir for your consideration, a help will be great for me, am really stuck here. my project in Python.
It sounds like you're trying to get the IP from this 3rd party service from your server, which would of course return the server's IP address.
Based on a comment on the question:
I am using streamlit for creating the web app.
Based on a cursory Google search, it sounds like getting the client's IP is non-trivial in that system:
https://discuss.streamlit.io/t/i-run-a-streamlit-app-and-it-processes-some-records-based-on-client-user-input-i-want-to-log-ip-address-of-client-user-and-records-processed-by-that-user-can-you-help-please/2382
https://discuss.streamlit.io/t/how-to-get-all-ip-addresses-and-their-countries-connecting-to-a-live-streamlit-app-on-aws-ec2/2273
https://discuss.streamlit.io/t/how-to-output-client-or-remote-ip-s-to-console/832
(Based on this I would probably recommend using a different Framework/platform for building web applications. This sounds... extremely limited. But that's another matter entirely.)
The service you reference would need to be accessed from the client computer, which means accessing it from JavaScript. If that service doesn't allow CORS requests, there are other options available. Once you have the value(s) you need in JavaScript, you can send them to your server-side code via an AJAX request, a Form POST, etc.
So I created a simple Flask app to automate certain calculations we often have to do in math class. I'm now trying to let my friends use it too but I can't get the local port forwarding right. When I run the app I can access it from my local network but not from outside of it. (I tested that by trying to reach the web app through my phone on mobile data, and it doesn't respond.) I'm aware that ssh tunnelling is probably a better way to do this, but I still want to figure out what I'm doing wrong here.
I am very new to this and used this video as a reference: https://www.youtube.com/watch?v=jfSLxs40sIw. Here's a brief summary of the things I already tried:
I changed app.run() to app.run(host='0.0.0.0',port=5000) to make Flask respond to all public ip's.
When I now run my app I can access it from my computer via:
http://0.0.0.0:5000/
http://127.0.0.1:5000/
http://192.168.1.101:5000/
I then used freedns.afraid.org to create a subdomain flaskdries.mooo.com. When redirecting the subdomain to the latest ip-adress in the list (192.168.1.101:5000) it would always refuse to connect, even on the pc that's running the app. Using 127.0.0.1:5000 eventually did the trick for all the devices on my network (image), but still not for devices outside of my network.
I guess that's an obvious thing since my WAN ip is nowhere to be specified in this method. So if I'm correct, when someone goes to the subdomain, there is no link to my router so also not to the device running the app. The problem is that I have no clue where I should specify my WAN ip or something similar.
I noticed that when I created the subdomain the destination was automatically set to my WAN ip
(image). At first I thought simply adding :5000 would work, but unfortunately it doesn't.
As you might have noticed I am extremely new to this and don't really have any other information i can rely on apart from the internet, so any help is welcome!
Thanks in advance,
Dries
After more research I figured out that the problem was that I have a seperate modem and router. For most people one port forward inside the router is enough, but I also had to forward a port from my modem to my router. Kind of annoying that I didn't think of that earlier. Thanks to everybody for responding tho.
Hi and welcome to stack overflow.
In order to access you app from the internet you will need an external static IP that you should be able to obtain from your internet provider. You then set your domain to point to that IP. If you don't want to specify the port each time, you can run you flask app on port 80 or 443 if you want https.
Also it is probably advisable to run it behind a web server of some sorts, like nginx since app.run is only intended to be used for local development.
You are using the ip adresses of you local network.
If you have port forwarding enabled to you machine then you have to use you public ip adress.
Your router should have the public ip adress in the admin interface.
Simplifiyed explanation:
You domain shoud lead to the external IP of your router.
Your router then forwards the request to your machine via portforwading (network IP address).
I am trying to deploy a Flask web app on google compute engine and am wondering:
What is the best instance type to use, is a g1-small sufficient?
What network traffic do I allow for the instance, HTTP and HTTPS or just one of them?
What port do I allow for the instance? I saw some people mentioned using tcp 5000.
Any other tips on instance or firewall specs would be much appreciated!
What is the best instance type to use, is a g1-small sufficient?
The answer depends on the traffic workload for your instance. Start with micro or small, monitor response time and adjust instance size to match the load.
What network traffic do I allow for the instance, HTTP and HTTPS or
just one of them?
That depends on what traffic/data you are serving. As a general rule, there is no reason to not implement HTTPS (SSL certificates) today.
What port do I allow for the instance? I saw some people mentioned
using tcp 5000.
You should not be serving using Flask's development server, which defaults to port 5000. Instead use a production server. You'll need to open whatever port you configure your server to listen on.
I want to share my local WebSocket on the internet but ngrok only support HTTP but my ws.py address is ws://localhost:8000/
it is good working on localhost buy is not know how to use this on the internet?
You can use ngrok http 8000 to access it. It will work. Although, ws is altogether a different protocol than http but ngrok handles it internally.
I have a "local" Oracle database in my work network. I also have a website at a hosting service.
Can I connect to the 'local' Oracle database from the hosting service? Or does the Oracle database need to be at the same server as my website?
At my work computer I can connect to the Oracle database with a host name, username, password, and port number.
It can depend on how your hosting is setup, but if it is allowed you will need the following.
Static IP, or Dynamic DNS setup so your home server can be found regularly.
Port forwarding on your router to allow traffic to reach the server.
The willingness to expose your home systems to the dangers of the internet
Strictly speaking a static IP/Dynamic DNS setup is not required, but if you don't use that kind of setup, you will have to change the website configuration every time your home system changes IPs, the frequency of which depends on your ISP. It's also worth noting that many ISP's consider running servers on your home network a violation of the terms of service for residential customers, but in practice as long as you aren't generating too much traffic, it's not usually an issue.
With Port forwarding on your router, you can specify traffic incoming on a particular port be redirected to a specific internal address:port on your network, (e.g. myhomesystem.com:12345 could be redirected to 192.168.1.5:1521)
Once those are in place, you can use the static IP, or the Dynamic DNS entry as the hostname to connect to.