Here are some clarifications, just in case :
Here is a minimal version of the Tornado’s server.py
file to see the configuration (the only notable thing is the port : 8443, and the mapping)
#! /usr/bin/python
import os.path
import tornado.httpserver
import tornado.websocket
import tornado.ioloop
import tornado.web
import asyncio
from tornado_request_mapping import request_mapping, Route
####### Serveur Tornado #######
PORT = 8443
settings = dict(
template_path = os.path.join(os.path.dirname(__file__), "templates"),
static_path = os.path.join(os.path.dirname(__file__), "static")
)
@request_mapping("/products")
class PainMainHandler(tornado.web.RequestHandler):
@request_mapping("/order.html")
def get(self):
print("[HTTP](MainHandler) User Connected.")
self.render("products/order.html")
@request_mapping("/ws")
class PainWSHandler(tornado.websocket.WebSocketHandler):
def open(self):
print('[WS] Connection was opened.')
async def on_message(self, message):
print('[WS] Incoming message:', message)
def on_close(self):
print('[WS] Connection was closed.')
if __name__ == "__main__":
try:
application = tornado.web.Application(**settings)
route = Route(application)
route.register(PainMainHandler)
route.register(PainWSHandler)
http_server = tornado.httpserver.HTTPServer(application)
http_server.listen(PORT)
main_loop = tornado.ioloop.IOLoop.instance()
print("Tornado Server started")
main_loop.start()
except:
print("Exception triggered - Tornado Server stopped.")
Trying this locally, everything works fine (I see the content of my order.html
page using the address http://localhost:8443/products/order.html).
I then uploaded these files on my VPS to run the tornado’s webserver by the side of the nginx server from the Seatable Docker image but whatever I tried in the nginx.conf
of the Seatable Docker image, I’m still getting an error (400 or 414 or 512 or the custom 404 page from Seatable).
Here is a part of the nginx.conf
file provided by Seatable :
server {
if ($host = myserver.vps.ovh.net) {
return 301 https://$host$request_uri;
}
listen 80;
server_name myserver.vps.ovh.net;
return 404;
}
server {
server_name myserver.vps.ovh.net;
listen 443 ssl;
ssl_certificate /shared/ssl/fullchain.pem;
ssl_certificate_key /shared/ssl/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# for letsencrypt
location /.well-known/acme-challenge/ {
alias /var/www/challenges/;
try_files $uri =404;
}
proxy_set_header X-Forwarded-For $remote_addr;
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
return 204;
}
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /opt/nginx-logs/dtable-web.access.log seatableformat;
error_log /opt/nginx-logs/dtable-web.error.log;
}
I tried adding a new server
configuration like
server {
listen 8443;
server_name myserver.vps.ovh.net;
location /pain {
proxy_pass http://127.0.0.1:8443/products/order.html;
proxy_redirect off;
access_log /opt/nginx-logs/products.access.log;
error_log /opt/nginx-logs/products.error.log;
}
}
with proxy_pass http://127.0.0.1:8443/products/order.html;
or proxy_pass http://127.0.0.1:8443/;
I also tried to add a new location in the second server
configuration like
server {
server_name myserver.vps.ovh.net;
listen 443 ssl;
listen 8443;
ssl_certificate /shared/ssl/fullchain.pem;
ssl_certificate_key /shared/ssl/privkey.pem;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# for letsencrypt
location /.well-known/acme-challenge/ {
alias /var/www/challenges/;
try_files $uri =404;
}
proxy_set_header X-Forwarded-For $remote_addr;
location / {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
return 204;
}
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /opt/nginx-logs/dtable-web.access.log seatableformat;
error_log /opt/nginx-logs/dtable-web.error.log;
}
location /products {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
if ($request_method = 'OPTIONS') {
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods GET,POST,PUT,DELETE,OPTIONS;
add_header Access-Control-Allow-Headers "deviceType,token, authorization, content-type";
return 204;
}
proxy_pass http://127.0.0.1:8443/products/order.html;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $server_name;
proxy_read_timeout 1200s;
# used for view/edit office file via Office Online Server
client_max_body_size 0;
access_log /opt/nginx-logs/products.access.log;
error_log /opt/nginx-logs/products.error.log;
}
with the same two proxy_pass
variants as before, but nothing worked. I’m sure I miss something…
By the way, I can’t write an http
block in the nginx.conf
file from Seatable, I get an error 
Thanks a lot,
Benjamin