Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All

I apologize for the more server configuration (I suspect) question than Perl itself but would greatly appreciate some help!

I have a perl script within a cgi-bin, which has an ajax POST to another .cgi script - but the AJAX response is always 403 forbidden. I can call the script directly, and use the other files fine (including post data) but for some reason this AJAX request always results in a 403... I'm baffled by this, any advice would be appreciated! Thanks John

Replies are listed 'Best First'.
Re: Script Forbidden Error
by erroneousBollock (Curate) on Oct 07, 2007 at 10:58 UTC
    Does the XMLHttpRequest call to the second URL reside in exactly the same fully qualified domain name as that which served it?

    That's usually the cause of security errors with AJAX applications. However....

    If you're getting a 403, that's presumably from the webserver hosting the second CGI... can you check the server logs for the reason the request was denied?

    -David

Re: Script Forbidden Error
by Gangabass (Vicar) on Oct 08, 2007 at 00:22 UTC

    Maybe this is cross-domain call which are forbidden in XMLHttpReques?

Re: Script Forbidden Error
by Cop (Initiate) on Oct 07, 2007 at 15:13 UTC

    For security, a page can only make an AJAX call to where it's from (with IE7 & Vista, even this is not 100% true), and I wish it will always stay like this, otherwise who knows what the freaks will do.

    You have to do a server side mesh up, so that the client side won't deal with a second site.