|
|
|
delohaas: @mikebodge Man, whatta night. Also, I misplaced the doc where I signed the rights to use my image. Can u resend, along
delohaas: @vivisarratt I know someone selling a 2001 Toyota Echo, stick shift for $3K. Is that beachy enough for you?
delohaas: I take one day off the interwebs and see what I miss? Congrats, @mikebodge & @missmimichi! Bonus game: spot me on
Accessing web services via AJAX by creating an Apache pass-through proxy on WindowsI've been working with a certain client for several years, and in that time I've built quite a few web sites for this client. Each of these sites connects to a web service that I developed and maintain. This web service delivers real-time numerical data, which the individual client sites use to populate charts and tables. Each site was built in ASP.Net, which allowed me to perform server-side processing to connect to the web service, fetch the data, and use it to populate controls on the page. That was all fine and dandy, especially since .Net provides lots of simple tools for web service handling. All fine until this week, when I received a request for a new site, one that has the requirement of no server-side processing. This means a web site built entirely in html and javascript. Luckily the client provided some javascript libraries for facilitating synchronous and asynchronous calls, meaning I didn't have to write code from scratch, nor did I have to create a custom jQuery solution. That doesn't mean that the development was without problem, though. I quickly ran into a very big browser issue: Most browsers don't allow cross-domain AJAX requests (IE has ways to getting around this). This means that they restrict AJAX requests to the same domain as the original page, and therefore I got a browser error when loading a page on localhost, and trying to make an AJAX connection to the live web service. The solution is pretty easy, and involves creating a pass-through Proxy. The trick is to make a call to a local URI, and have Apache pass that request along to the web service. That way Firefox is happy because it thinks that all AJAX requests are made to the same domain, but in fact Apache is acting as your proxy and calling the web service for you. There's a lot of documentation out there on how to do this, but I want to provide a concise, easy-to-understand set of instructions for Windows users. Here's the two quick and easy steps to create an Apache pass-through proxy: 1) Make sure 'proxy' and 'proxy_http' modules are enabled. On Unix you should use the simple "configure" command to do this, but on Windows this means uncommenting the following lines in httpd.conf:
2) In httpd.conf, create the proxy rule. For the a rates service with the url http://www.example.com/Service.asmx, this means adding something like this line:
Then make sure you restart Apache. Now you can make AJAX calls to /service, and Apache will pass it through to http://www.example.com/Service.asmx, and you'll be on your way!
delohaas: Payback time: turning the tables & cooking for the Frankies staff for a change.
delohaas: Seems the entire cast is on Twitter RT @SammLevine: Freaks & Geeks is back on TV starting Friday night! http://bit
delohaas: @mihow Highly recommend you follow @shunafish for further inspiration on the pastry front.
delohaas: @mikebodge That's why I'm buying a car next week. Weekend getaways!
delohaas: This is the kind of animation I've been waiting my whole life to see: How Mariano Rivera Dominates Hitters - http://ny
delohaas: @ryantomorrow For a slim dress shirt like that under $100 you gotta consider UniQlo or Club Monaco.
|
Other LinksFriends:
Find me here:
|