Re: GWT2.0: POST request for some reasnos converted to OPTIONS in new hosted mode
On Dec 21, 4:00 pm, Mike Chaliy <m...@chaliy.name> wrote:
> My application in hosed mode (http://localhost:8888) send plain HTTP
> POST requests for example to thehttp://localhost/Inventory/.
>
> After upgrade from GWT1.7 to GWT2.0, all POST requests are now sent as
> OPTIONS request.
>
> Method: OPTIONS
> Host: localhost
> User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; uk; rv:1.9.1.6)
> Gecko/20091201 Firefox/3.5.6
> Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
> *;q=0.8
> Keep-Alive: 300
> Connection: keep-alive
> Origin: http://localhost:8888
> Access-Control-Request-Method: POST
>
> So the querstions are:
>
> 1. Why GWT do so?
GWT doesn't do anything here (even less in GWT 2.0 with DevMode than
in previous versions where the browser was embedded into GWTShell/
HostedMode)
> 2. How to disable this?
>
> May be this is because of "same origin policy" issue?
Exactly: Firefox 3.5 supports "CORS" which allows cross-origin
requests under certain conditions. One of these is to first ask the
server if it accepts such cross-origin requests (instead of just
failing without even attempting a request, as previous Firefox
versions did), and this is done with an OPTIONS request containing an
Origin and Access-Control-Request-Method request headers. You're just
seeing this "preflight" request. This not a bug, neither in GWT nor in
Firefox; maybe in you code, as it means you're using absolute
references in requests ("http://blablabalbla"), which are likely to
break in most browsers (Firefox 3.0 and previous versions, Internet
Explorer –IE8 uses an XDomainRequest for CORS-like functionnality,
instead of XMLHttpRequest–, Safari, Opera 9.x, etc.)
Same goes for other browsers (last versions of Chrome and Opera
support it AFAICT), as CORS is a being developped at the W3C.
--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home