0

I have a qooxdoo project that fetches JSON from an online server using the following codes:

var url = "http://www.example.com/json.php?q=parameter_here";
var store = new qx.data.store.Json(url,"GET", "text/plain");
store.addListener("changeModel", function(ev) {
    console.log("changeModel()");
    console.log("getData", ev.getData());
});
store.addListener("error", function(ev) {
        console.log("error", ev.getData());
    });
    store.addListener("changeState", function(ev) {
    console.log("state", ev.getData());
});

I'm using iMac, and the local path is /Users/SomeUser/Path/To/index.html

I tried to load the index.html in Chrome browser as usual, but failed, as Chrome blocks the Javascript as Origin null is not allowed by Access-Control-Allow-Origin. After I read the answer from this question, I know I have to host it in a web server. Therefore I set up a XAMPP for this site.

Since my XAMPP has few existing Alias, I add a new Alias for this site, as follow:

<Directory "/Users/SomeUser/Path/To">
        Options All
        AllowOverride All
        Require local
        Order allow,deny
        Allow from all
</Directory>
Alias /myalias "/Users/SomeUser/Path/To"

When I set up the Alias like this, 403 Forbidden is reported. Then, I found this question on SO, but the answers didn't help. Still 403 Forbidden.

My goal is to load the site in local XAMPP server. What did I miss? When I upload the folder to a web server online, it works fine.

In XAMPP Apache error_log, it shows:

[Fri Apr 19 17:51:09 2013] [error] [client 127.0.0.1] (13)Permission denied: access to /myalias/index.html denied

For the file, its permission is:

drwxr-xrwx  7 SomeUser  staff  238 Apr  2 16:48 .

Note: I don't want to change the Chrome launch options to override the Access-Control-Allow-Origin policy.

Community
  • 1
  • 1
Raptor
  • 53,206
  • 45
  • 230
  • 366

1 Answers1

0

You do realize that all you have to do is to go to your xampp/mamp install folder, locate the htdocs folder and inside of it create a new folder with your project(say test) then access it in your browser like: http://localhost/test/ right ?

Twisted1919
  • 2,430
  • 1
  • 19
  • 30
  • Documents in other Alias and documents in the `htdocs` directory works fine. – Raptor Apr 19 '13 at 10:51
  • maybe a blind shot, but what if you create a local domain (say whatever.com) and map it to 127.0.0.1 ? In windows you would map this in hosts file, in linux in /etc/hosts in macos i am not sure, but should be something similar. Then access it instead of accessing localhost. This might do the trick. – Twisted1919 Apr 19 '13 at 10:54
  • tried but it is the same 403 Forbidden. Mac OS X has hosts file as other Linux-based OS does ( located at `/etc/hosts` ). – Raptor Apr 19 '13 at 11:04
  • what's happening if you chmod -R 0777 the-folder ? Under which user your apache is running? try chown -R apacheUser:apacheUser the-folder – Twisted1919 Apr 19 '13 at 11:10
  • my Apache ( XAMPP's one) is running with `root` account. – Raptor Apr 20 '13 at 15:45