LNT server behind a proxy and mounted in a /subdir

Hi all,

I want to install an LNT server. For reasons that don’t matter much I can’t have something like


but instead I can have


I’m definitely not an expert in web applications nor WSGI but I managed to configure the front-end server (the one that serves dept.acme.org) to proxy /lnt to the server that lnt runserver creates.

The problem I found is that the server started by “lnt runserver” is not aware that as a web application it is running under “/lnt”, not under “/”. This means the URLs rendered by the application are wrong.

I didn’t find any obvious way to fix this so I amended lnt/lntool/main.py to accept a “–subdir” flag. I then wrapped the app just created using a “werkzeug.wsgi.DispatcherMiddleware” with the mount point specified in “–subdir”

Then I found another issue is that the https connection terminates at the front-end server and “lnt runserver” is again not aware of https. Sometimes the web application renders full URLs with http. Again I hacked lnt/lntool/main.py to accept a “–scheme” flag so I can wrap again the app, this time using a custom “middleware” that fixes the scheme.

With these two changes the web application seems to work fine :slight_smile:

Has anyone run a similar setup? I feel my solution is a bit hacky, perhaps there is already a way to do this? Or else, it might be better to encode these two options in lnt.cfg?

Not sure if anyone would be interested in supporting this (perhaps unusual) scenario.

Kind regards,