If you want to make sure your replit site only serves https you can use this middleware.
I made a version of this that works in flask, here it is:
@app.before_request def force_https(): if 'X-Forwarded-Proto' in request.headers: if request.headers['X-Forwarded-Proto'] == 'http': return redirect(request.url.replace('http://', 'https://'))```
wait how does this work with pre-existing middleware (because I have a middleware that checks a JSON file to see if the file is "locked"). I'm concerned that I'll get a "you can't change headers after they've been sent" error, but I'll try it first :P
Edit: works fine but I had to go about some minor changes