[Javascript] Ajax & proxy question
Nick Fitzsimons
nick at nickfitz.co.uk
Fri Jan 12 11:25:17 CST 2007
On 12 Jan 2007, at 16:42:23, Matt Murphy wrote:
> our company has a proxy server. Whenever I use an ajax script to
> request something from the server, if it's going through the proxy
> it fails. I'm trying to figure out if the HTTPRequest method is a
> standard port 80 HTTP request to the server? and back? It seems
> like it is, and therefore should work through the proxy just fine.
Yes, it's just a standard HTTP request over port 80. No different to
what the browser does for every single thing it downloads.
> Any clues as to what's going on?
Some code might help. The clues are either in the code, or on the wire.
> If my ajax function does all the screen updating on the client
> side, and just sends stuff back to the server to update the db, no
> problem. But if I need to eval some code back from the server, no
> luck.
When you say "No luck", do you mean that you get an error, or that it
fails silently, or that it does something other than what you expect
but without any error? What do you actually get back from the server?
What's the response code? (Anything other than 200 usually means
something's mucking up outside the client.) What format is it in -
plain text, XML, JSON, HTML? Is it well-formed for the format you are
using? Does the ContentType header you send it back with properly
reflect its type?
For starters, try using
alert(foo.responseText);
in your callback function to see what's actually coming back. If that
doesn't help, use the Firebug extension for Firefox to examine
exactly what's coming and going over the wire. Check HTTP headers,
and make sure your text encoding is actually what your headers say it
is, as otherwise some characters might be misinterpreted.
And be aware that large numbers of proxies are misconfigured, and may
strip or change headers. You might have to bang some network admin
heads together. Having said that, I would guess that 90% plus of Ajax
problems are in the client code or the server code, not the network.
(If you could post an example page on a publicly accessible server,
it would allow us to at least determine if the error is in your
client code, or in the response. But I appreciate that this isn't
always possible.)
HTH,
Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/
More information about the Javascript
mailing list