Using flask to return server side processed URL

I am hosting my web app on my in-house server using flask (100% accessible online – running on host 0.0.0.0), however, I am trying to use flask to navigate to other locally hosted web apps while browsing from a public network .. is it possible? i.e. onclick() i would like to redirect to URLs that are only available on the local network .. is this possible? I am essentially looking to use my flask app to access my LAN .. thanks!

from flask import Flask, redirect

app = Flask(__name__)

@app.route('/<ip>')//local ip
def redirect_to_link(ip):
    return redirect('ip') #would like this to be processed server side and displayed through flask 

Answer

If the other apps are accessible from extern , yes , you can. If not , you can try serving other app pages by making a request to your flask app first. Flask application should download the webpage for you and then serve it to you externally. Basically you want to make a proxy server.

Try this:

import requests
from flask import Flask, redirect

app = Flask(__name__)

@app.route('/<ip>')//local ip
def redirect_to_link(ip):
    return redirect('ip') #would like this to be processed server side and displayed through flask 


#local url address to serve examples: 
#192.168.1.123:8888/whatyouwant
#192.168.1.123:5656/
#192.168.1.123/somepage
#192.168.1.123


@app.route('/lan/<url>') 
def serve_from_lan(url):
   r = requests.get("http://"+url, allow_redirects=True)
   return r.content

So simple it’s not secure but can do the job . then you can think about security.

Also consider that all the addresses present in the application pages in lan should refer to your flask app to be navigable-