Lifehack for Same-Origin-Policy; Google Chrome and other

mardi 22 janvier 2013


debuger

Task:
- There is a REST-server
- There is a one-page application (HTML / CSS / Javascript) that takes the data from the server via XMLHttpRequest
- You need to develop a new feature



When before the front-end developers have this problem vskidku have two options:
- To raise the test server at localhost on
- Ask the Back-end add to the server response header «Allow-Control-Allow-Origin: *» that-be use XMLHttpRequest2

The first option, the costs in time, and not always possible. Neither one is not the best - to put «Allow-Control-Allow-Origin: *» not seem safe, and the back-end can do it for a long time.

And then I came up with the idea seems to be trivial - but why change the server headers if this can be done directly on the client.

About Fiddler I've tried to write once.

Solution with Fiddler

I'm afraid that if this article is over the audience would not appreciate, and I zaminusovali and post a little less than full, so here is a solution for those who do not want to have anything to do with Fiedler and who are not looking for easy ways.

Among the extensions for Chrome for some reason I did not make it one that could change the Response-header, although maybe I was looking bad. Therefore, I decided to quickly write your bike. link to expand and github because it is fashionable and youth

Extension for Chrome

As for FF - for some reason, and here I found extensions to spoof a response from the server, but again, can bad looking. If someone tell me put you in the post.

PS
I hope you will come in handy extension or advice. For those to whom it seemed banal and not worthy Habra I'm sorry, but at least one person that was not so obvious as you have become a useful (to me).
I have concerns about safety, the idea with the included extension from any site on the score CORS , but we're all honest and we will use it only for development.

0 commentaires:

Enregistrer un commentaire

 
© Copyright 2010-2011 GARMOBI All Rights Reserved.
Template Design by Herdiansyah Hamzah | Published by Borneo Templates | Powered by Blogger.com.