how 🤔.. i try via decorator.. but its show connection reset
acc to first search result of google: https://stackoverflow.com/questions/18962418/https-with-http-in-flask-python
suppose i want to run an endpoint only on https /admin -> https /dashboard -> http
i got this from some random website : from flask import Flask, redirect, request, url_for app = Flask(name) @app.route('/admin', methods=['GET']) def admin(): if request.is_secure: # The request is already using HTTPS, so proceed with handling the endpoint. return 'Admin Page (HTTPS)' else: # Redirect the request to the HTTPS version of the endpoint. return redirect(url_for('admin', _scheme='https', _external=True)) @app.route('/dashboard', methods=['GET']) def dashboard(): if request.is_secure: # Redirect the request to the HTTP version of the endpoint. return redirect(url_for('dashboard', _scheme='http', _external=True)) else: # The request is already using HTTP, so proceed with handling the endpoint. return 'Dashboard Page (HTTP)' if name == 'main': app.run(port=5000)
i think same.. means we just need to make decorator .. and filter the stuff 😱😱
To post more than a few lines of code, use a pastebin like: * dpaste.org * linkode.org * bin.kv2.dev * hastebin.com If you are stuck in a terminal, you can use ix.io or paste.rs to paste from the CLI: <command to print output> |& curl -F 'f:1=<-' ix.io <command to print output> |& curl --data-binary @- https://paste.rs
Also, try making a habit of including your sources in your replies
Обсуждают сегодня