Redirect to https in Node.js
amasad (2280)

If you want to make sure your replit site only serves https you can use this middleware.

You are viewing a single comment. View All
AllAwesome497 (349)

I made a version of this that works in flask, here it is:

def force_https():
	if 'X-Forwarded-Proto' in request.headers:
		if request.headers['X-Forwarded-Proto'] == 'http':
			return redirect(request.url.replace('http://', 'https://'))```