Monday, September 2, 2013

Create a Simple HTTP Server on a directory to bypass same origin policy


Let's say you are doing development of a website that uses Javascript on your laptop. Often you will notice that you will run in to issues where the browser does not allow you to access certain resource because of the same origin policy. Also, often at times you are working on a bunch of HTML files and want to host a few files over HTTP.

You can do it quickly by creating a simple HTTP server that will open access to all files in the directory over HTTP. Here's the nifty python command that does that:

python -m SimpleHTTPServer 8900

Where 8900 is the port you want the content to be hosted upon.


No comments:

Post a Comment