Skip to main content

Command Palette

Search for a command to run...

Adding CORS Support to a Tornado BaseHandler

How to enable CORS to your Tornado REST APIs

Updated
•1 min read•View as Markdown
A

I am a developer from the Greater Boston area, I have a M.S. in Computer Science and Engineering from the University of Connecticut, focused on Bayesian Networks and Bayesian Knowledge Bases. I have experience working on 3D laser scanners, motion platforms, DARPA projects, 3D simulations using the Unity game engine for robotics in synthetic environments (game generated and scanned), mobile development in both Android and iOS.

My strengths are in rapid prototyping and taking an idea into a release candidate. The process is a winding road that takes a lot of time

Quick How To

This is a short reference to modify a custom Tornado BaseHandler to support Cross-Origin Resource Sharing (CORS) so that your REST API can be used from other domains with out raising browser errors. Here is the code on how to accomplish that:

To use the code just use the new BaseHandler as an argument instead of the tornado.web.RequestHandler that is normally used.

More from this blog