Janis Lesinskis' Blog

Assorted ramblings

  • All entries
  • About me
  • Projects
  • Economics
  • Misc
  • Software-engineering
  • Sports

Getting CORS to work with Flask


If you've ever created a web application you might have run into difficulties with Cross Origin Resource Sharing which is commonly referred to by its acronym CORS.

Recently I've been looking at some web projects and I ran into a particularly annoying issue with getting CORS to work with Flask. This particular project was using Flask-CORS to do the necessary CORS handling.

It turns out that if you use blueprints with Flask then CORS is not automatically applied to these blueprints. You have to manually enable CORS on each and every blueprint. There's an open issue about this from 2019 but as far as I can tell this is still the case in 2021.

Published: Tue 14 September 2021
By Janis Lesinskis
In Software-engineering
Tags: flask web-development CORS software-engineering

links

  • Scry Engineering
  • JaggedVerge

social

  • My GitHub page
  • LinkedIn
  • Twitter

Proudly powered by Pelican, which takes great advantage of Python.