corydolphin / flask-cors

Cross Origin Resource Sharing ( CORS ) support for Flask
https://flask-cors.corydolphin.com/
MIT License
877 stars 137 forks source link

"Origin header does not match any of allowed origins" despite having origins as '.*' #236

Closed huberrom closed 5 years ago

huberrom commented 5 years ago

Hi, I have the following stack trace when using flask cors :

rasa_core_1      | 2018-12-28 15:42:23 DEBUG    flask_cors.core  - CORS request received with 'Origin' http://localhost:8080
rasa_core_1      | 2018-12-28 15:42:23 DEBUG    flask_cors.core  - The request's Origin header does not match any of allowed origins.
rasa_core_1      | 2018-12-28 15:42:23 DEBUG    flask_cors.core  - Settings CORS headers: MultiDict([])
rasa_core_1      | 2018-12-28 15:42:23 DEBUG    flask_cors.extension  - Request to '/conversations/15bfb095-604a-47a1-ad53-87235593ca61/tracker/events' matches CORS resource '/*'. Using options: {'origins': ['.*'], 'methods': 'DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT', 'allow_headers': ['.*'], 'expose_headers': None, 'supports_credentials': False, 'max_age': None, 'send_wildcard': False, 'automatic_options': True, 'vary_header': True, 'resources': {'/*': {'origins': '*'}}, 'intercept_exceptions': True, 'always_send': True}

And I don't understand the second line, since the fourth one shows that the accepted origins are '.*' (which means everything right ?)

My code look like that:

custom_webhook = Blueprint(
            'custom_webhook_{}'.format(type(self).__name__),
            inspect.getmodule(self).__name__)
        CORS(custom_webhook)

@custom_webhook.route("/1.0.0/conversations/<sender_id>/tracker/events", methods=['POST'])
        def append_event(sender_id):

I'm using flask_cors 3.0.4 and the request looks like this : image

huberrom commented 5 years ago

I noticed that it works with GET method but not POST.

huberrom commented 5 years ago

Sorry I was calling the wrong route, my bad !