Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

it don’t work #305

Closed
limoruirui opened this issue Jan 9, 2022 · 2 comments
Closed

it don’t work #305

limoruirui opened this issue Jan 9, 2022 · 2 comments

Comments

@limoruirui
Copy link

limoruirui commented Jan 9, 2022

It doesn't work properly, when I ask for a front end. My API uses the server's public IP: port, not using the HTTPS protocol but use the HTTP protocol(http://ip:3000/index). The following is my code and log.

cat server.py

from flask import Flask, request, jsonify, make_response
from flask_cors import CORS
import logging

from login import login, getToken

app = Flask(__name__)
logging.basicConfig(level=logging.DEBUG, filename='loginDEBUG.log', filemode='a')
logging.getLogger('flask_cors').level = logging.DEBUG
CORS(app, supports_credentials=True)

@app.route('/index', methods=['get'])
def index():
    token = {'token':getToken()}
    token1 = make_response(jsonify(token))
    token1.headers['Access-Control-Allow-Origin'] = '*'
    token1.headers['Access-Control-Allow-Method'] = 'GET'
    token1.headers['Access-Control-Allow-Headers'] = 'x-requested-with,content-type'
    return token1
if __name__ == '__main__':
    app.run(host='0.0.0.0', port='3000', debug=True)`

cat loggingDEBUG.log

DEBUG:flask_cors.extension:Configuring CORS with resources: {'/*': {'origins': ['.*'], 'methods': 'DELETE, GET, HEAD, OPTION�S, PATCH, POST, PUT', 'allow_headers': ['.*'], 'expose_headers': None, 'supports_credentials': True, 'max_age': None, 'send_�wildcard': False, 'automatic_options': True, 'vary_header': True, 'resources': '/*', 'intercept_exceptions': True, 'always_s�end': True}}
WARNING:werkzeug: * Running on all addresses.
WARNING: This is a development server. Do not use it in a production deployment.
INFO:werkzeug: * Running on http://10.0.20.16:3000/ (Press CTRL+C to quit)
INFO:werkzeug: * Restarting with stat
DEBUG:flask_cors.extension:Configuring CORS with resources: {'/*': {'origins': ['.*'], 'methods': 'DELETE, GET, HEAD, OPTION�S, PATCH, POST, PUT', 'allow_headers': ['.*'], 'expose_headers': None, 'supports_credentials': True, 'max_age': None, 'send_�wildcard': False, 'automatic_options': True, 'vary_header': True, 'resources': '/*', 'intercept_exceptions': True, 'always_s�end': True}}
WARNING:werkzeug: * Debugger is active!
INFO:werkzeug: * Debugger PIN: 971-442-410
@nejat-njonjo
Copy link

Try to phrase your question/issue properly so that you get a proper solution to your problem.

But What I am getting from is the same issue about cors Issue 305 about CORS

@derek-adair
Copy link

This is not a good question for this bug tracker as this is almost certainly not a bug. This type of question would garner much better results on stackoverflow.com and doesn't belong here.

@corydolphin corydolphin closed this as not planned Won't fix, can't repro, duplicate, stale Jun 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants