I have read all available solutions to my problem, still cannot figure out problem.
I have tried all available solutions, but cannot find anything helpful.
Whenever I send request, browser blocks request under CORS Policy.
My Flask App responds to OPTIONS call with code 308.
I have also tried adding resources={r"*": {"origins": "*"}}
while initialising object.
I have also tried doing app.config['CORS_HEADERS'] = 'Content-Type'
Nothing Works.
Backend:
from flask import Flask, make_response
from flask_cors import CORS
from tracer.blueprints.auth import app as auth_blueprint
from tracer.blueprints.url import app as url_blueprint
app = Flask(__name__)
CORS(app)
app.register_blueprint(auth_blueprint, url_prefix='/auth')
app.register_blueprint(url_blueprint, url_prefix='/url')
@app.route('/')
def home():
return make_response('<center><h2>APIs hosted here.</h2></center>')
if __name__ == '__main__':
app.run()
Frontend: (Nuxt Axios):
context.$axios.setHeader('token', token);
context.$axios.setHeader('Content-Type', 'application/json')
const response = await context.$axios.$post(
"http://127.0.0.1:5000/url",
{
redirect: url
}
);
question from:
https://stackoverflow.com/questions/65939698/flask-cors-not-working-nuxt-flask-jwt-used 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…