View Full Version : Ext.Direct call sending an HTTP OPTIONS cmd

5 Mar 2010, 1:45 PM
I am trying to use Ext.Direct with a remote site. I defined my API like this:

MSMWeb.API = {
If I attempt to call my method setIPv4 I see inside Firebug an


But if I replace the url with a local value such as


and I call it, I then see an HTTP POST

POST router.php

Can someone explain this behavior and how I can actually get a POST with a remote URL using Ext.Direct?

Yannick Koehler

6 Mar 2010, 12:36 PM

I believe should be


If that is where your router is located. It doesn't know to use router.php as the router. You router process could be named anything.

8 Mar 2010, 2:35 AM
You can't: http://en.wikipedia.org/wiki/Same_origin_policy

8 Mar 2010, 7:45 AM
You can't: http://en.wikipedia.org/wiki/Same_origin_policy

Actually, I can...

Using that document about same origin policy, I've altered my server to answered positively to the HTTP OPTIONS and the browser did follow with an HTTP POST.

So I did found how to solve this case, my next problem thought is that my server reply and the browser do not see the "data" portion of the reply but do see the header.

Even wireshark see the data and things seems to be valid yet the browser firebug and extjs do not seems to like it.

POST /ext/direct/router HTTP/1.1
User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2) Gecko/20100304 Gentoo Firefox/3.6 FirePHP/0.4
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: fr-ca,fr;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
X-Requested-With: XMLHttpRequest
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 113
Pragma: no-cache
Cache-Control: no-cache

HTTP/1.1 200 OK
Server: Myserver
Date: Mon, 08 Mar 2010 15:41:41 GMT
Connection: close
Pragma: no-cache
Cache-Control: no-cache
Content-Type: text/html
Content-Length: 91


I fail to see what firefox or extjs do not like, the header is properly separated by a \r\n the data content of the reply is valid JSON, yet when I look inside Firebug it says that it received 91 B of size in the body response yet in the "Response" tab there is nothing, it's empty.

Any idea or suggestion?

Yannick Koehler

15 Sep 2010, 6:34 AM
Very late to a thread again, but in case it help someone else in the future:

I was doing precisely this - cross domain requests to am ExtDirect server.
What I found I had to do was that the browser first sends an OPTIONS call, which I reply to in order to say that I'm happy to be called from a different origin, so the following headers but no body

Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: POST, GET , OPTIONS
Access-Control-Allow-Headers: X-Requested-With, Content-Type

and then for each subsequent request (GET, POST etc) I have to again say that I'm happy to allow a different origin by adding the following HTTP header to the response

Access-Control-Allow-Origin: *

and then the browser will happily pass the result thru to the javascript code.

In this case I'm allowing absolutely any different origin ("*") but YMMV

5 Jun 2013, 10:18 PM
Hello everyone,
I have the same problem about cross domain I am using sencha touch and using ext direct I want to access methods in different domain. How can I do this? Can you provide us a little but main code?