I started working on a small JavaScript app today that utilizes the Clipped API (http://clipped.me/api.html), but learned that there are cross-domain AJAX call issues, and the developer of the API didn't add support for JSONP. Here's the app itself:
var clippedAPI = "http://clipped.me/algorithm/clippedapi.php";
$.ajax({
url: clippedAPI,
type: "GET",
dataType: "JSONP",
data: {
url: "http://pandodaily.com/2013/03/26/y-combinator-demo-day-2013-still-looking-for- the-next-airbnb-or-dropbox/"}
}).done(function(json) {
console.log("JSON Data: " + json.title );
}).fail(function(jqxhr, textStatus, error){
var err = textStatus + ', ' + error;
console.log("Request Failed: " + err);
});
I've set up an Apache server on my Ubuntu machine, and have been suggested to use mod_proxy to set up a reverse proxy. The problem is that I just don't know how to do this -- this is my first time using Apache. I know all the basics like accessing my main Apache config files in Terminal. Can anyone give a noob a run-down on how to do this?
Setting up a reverse proxy using Apache in Ubuntu:
1. Install reverse_proxy module
sudo apt-get install libapache2-mod-proxy-html
2. Install libxml if it is not already installed.
apt-get install libxml2-dev
3. Load the modules in apache2.conf file
LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so
LoadModule deflate_module /usr/lib/apache2/modules/mod_deflate.so
LoadFile /usr/lib/libxml2.so
4.Say you want to forward all requests starting to internal.server then add the following to your apache2.conf file
# Disable proxy requests, using ProxyPass in vhost
ProxyRequests Off
# Block all requests
<Proxy *>
Order deny,allow
Deny from all
</Proxy>
<Proxy balancer://cluster>
BalancerMember http://internal.server:802
BalancerMember http://internal.server:801
#below is to transfer sessions
#ProxySet lbmethod=bytraffic
</Proxy>
<Location /balancer-manager>
SetHandler balancer-manager
Order Deny,Allow
# Deny from all
Allow from all
</Location>
5.Hopes you are good to go.!
update:
sudo aptitude download libxml2
sudo ar -xf libxml2_2.7.8.dfsg-5.1ubuntu4_amd64.deb
the following files will be extract from ubuntu package.
control.tar.gz data.tar.gz debian-binary libxml2_2.7.8.dfsg-5.1ubuntu4_amd64.deb
# rm libxml2_2.7.8.dfsg-5.1ubuntu4_amd64.deb control.tar.gz
# tar xf data.tar.gz
# cd usr/lib/x86_64-linux-gnu/
# ls
The following files will be there
libxml2.so.2 libxml2.so.2.7.8
# mv * /usr/lib/x86_64-linux-gnu/
# cp /usr/lib/x86_64-linux-gnu/libxml2.so.2* /usr/lib/
# /etc/init.d/apache2 start