Solved

Bypass cross origin issues on development site

Posted on 2016-11-30
3
78 Views
Last Modified: 2016-11-30
I am testing my website locally on a Mac in Firefox.

I have a Microsoft IIS server where ASP scripts are located.

My local Javascript file references a script like this:

$.get('http://www.domain.com/_script.asp', {email:email}, function(result){...

Open in new window


Of course, when I test my local website, I get Cross-Origin Request Blocked errors in Firefox. It isn't clear to me if these errors are coming from Firefox (local computer) or from the server. Or both?

At least for testing purposes, is it possible for me to bypass these errors? I don't want to permanently undo any security settings. After the website goes live I would want it as it is now. But for testing, it would be really convenient if I could access those scripts from my local development site.

Thank you.
0
Comment
Question by:bbdesign
3 Comments
 
LVL 33

Accepted Solution

by:
Big Monty earned 250 total points
ID: 41907643
taken from here

Chrome has a wonderful command line argument to disable web security.  To start Chrome with web security disabled, run the following command:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --disable-web-security
0
 
LVL 14

Assisted Solution

by:Juan Ocasio
Juan Ocasio earned 250 total points
ID: 41907647
Try adding the following to web.config:
<configuration>
 <system.webServer>
   <httpProtocol>
     <customHeaders>
       <add name="Access-Control-Allow-Origin" value="*" />
     </customHeaders>
   </httpProtocol>
 </system.webServer>
</configuration>
0
 

Author Comment

by:bbdesign
ID: 41907728
web.config isn't an option for me, unfortunately, because I am on IIS 6.

I found a Firefox add-on called "cors everywhere" which seems to do the trick. Similar to the Google Chrome suggestion. I didn't realize the setting was in the browser and could be controlled in that way.

Thanks for the input!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question