ash пре 2 година
родитељ
комит
e87299d1a5
1 измењених фајлова са 7 додато и 5 уклоњено
  1. 7 5
      Backend/Sources/View/view_manager.py

+ 7 - 5
Backend/Sources/View/view_manager.py

@@ -27,8 +27,8 @@ __app__.secret_key = "aseqzdwxc"
 __app__.permanent_session_lifetime = timedelta(minutes=2)
 __app__.logger = logger
 __app__.config['JSONIFY_PRETTYPRINT_REGULAR'] = True
-flask_cors.CORS(__app__)
-
+#flask_cors.CORS(__app__)
+#logging.getLogger('flask_cors').level = logging.DEBUG
 
 limiter = Limiter(__app__,key_func=get_remote_address,default_limits=["100 per minute"])
 limiter.logger = logger
@@ -68,9 +68,11 @@ def after_request(response : flask.Response):
     # adding this to the header to allow cross origin
     # for exemple origin cross origin is when website with javascript has it's server (origin 1)
     # and the javascript call some request on another server (origin 2), typically our API.
-    #header['Access-Control-Allow-Origin'] = '*'
-    #header['Access-Control-Allow-Methods'] = 'GET,DELETE,UPDATE,HEAD,OPTIONS,POST,PUT'
-    #header['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
+    header['Access-Control-Allow-Credentials'] =  'true'
+    header['Access-Control-Allow-Origin']  = 'http://127.0.0.1:8000'
+    header['Access-Control-Allow-Methods'] = 'GET,DELETE,UPDATE,HEAD,OPTIONS,POST,PUT,PATCH'
+    header['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
+    header['Access-Control-Allow-Headers'] = 'Origin, X-Requested-With, Content-Type, Accept, Authorization'
 
     logger.debug(response.__dict__)