I'm trying to build a cors proxy through flask from scratch. Here's my code
@app.route('/api/v1/cors/url=<name>&method=<method>', methods=['GET'])
def api_cors(name, method):
if method == 'http' or method == 'https':
r = request.urlopen(method+"://"+name)
return r.read()
else:
return "method not set!"
It is working good so far but I have one problem, when I pass "url=google.com&method=https" it is working fine but when I pass something like "url=google.com/images/image.jpg&method=https" the "/" will considered as a new directory
Is there anyway to evade this in flask?