extjs - Issue with basic auth -
edited clarity:
using python/flask rest-api provide secure endpoints (using basic auth) extjs app. cors enabled. had been working splendidly in testing safari. decided test other browsers (ie, chrome , firefox) outcome keep getting 401 error , no login dialog.
i found following blog post http://mortoray.com/2014/04/09/allowing-unlimited-access-with-cors/ suggested add following chunk of code ensure headers covered endpoints:
@app.after_request def add_cors(resp): """ ensure responses have cors headers. ensures failures accessible client. """ resp.headers['access-control-allow-origin'] = request.headers.get('origin','*') resp.headers['access-control-allow-credentials'] = 'true' resp.headers['access-control-allow-methods'] = 'post, options, get' resp.headers['access-control-allow-headers'] = request.headers.get( 'access-control-request-headers', 'authorization' ) # set low debugging if app.debug: resp.headers['access-control-max-age'] = '1' return resp
i added api code in hopes work, seems have made no difference.
the api hosted via apache using mod_wsgi , authentication being passed off wsgi app using wsgipassauthorization on
directive.
needless say, confused. shouldn't login dialog if 401 error detected?
i ended moving extjs , api apps same server (using apache mod_alias extjs app , wsgiscriptalias directive mod_wsgi flask app). works charm , no cors issues. notwithstanding terrible solution chrome, think there no fix firefox, , don't ie. have better things do.
Comments
Post a Comment