This question continues from here.
I want to create a reverse proxy of sorts that will allow me to host an application that runs on a specified port on a server that does not have that port open. But I do not want take over ports 80/443 because I need to have other apps running on that server. Instead, I want an app running at localhost:####
to be served from a suburl or subdomain such as http://myserver/myapp
.
Here is what I tried:
helloflask.py
#!/usr/bin/env python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
if __name__ == '__main__':
app.run()
middle.py
#!/usr/bin/env python
print ("Content-Type: text/html")
print()
import requests
#response = requests.get("http://localhost:5000")
response = requests.get("http://localhost:8888/token=8a387fe88d662e2568f9b8ec2398191452492e7184536670")
print(response.text)
When I run helloflask.py
it runs on port 5000, and I can visit mydomain/middle.py
and get the correct response of "Hello World!" displayed in the browser.
However, when I run a jupyter notebook on port 8888, I get a malformed web page. Strangely, the page sources are identical (see the diff).
So, what do I need to do to make jupyter run from the proxy?
Here is an image of how the page appears through middle.py
. The link to IPythonParallel works, but no other links or controls function in any way.