Copy link to clipboard
Copied
I have a cross domain ajax call properly set up and tested to resolve to a .cfm but IIS throws a 500 error.
Here is the scenario:
On one domain (a.tld) I have an ajax application.
This application posts to another domain (b.tld).
When a.tld posts to a .cfm on b.tld, I get a 500 error. But, when a.tld posts to a .aspx on b.tld, it returns just fine. Both the .cfm and the .aspx are returning a single json name value pair (really just some text).
Now, this is interesting, when I switch the POST to a GET, the .cfm works just fine. So, to summarize:
1. ajax POST to aspx works fine.
2. ajax POST to cf gives 500 error.
3. ajax GET to cf is fine.
So, this appears that IIS is blocking ColdFusion from getting the cross domain ajax call or that ColdFusion does not have permission to act on the POST. Does anyone know what might be causing this issue?
Copy link to clipboard
Copied
Have the same problem. Ajax and Post do not play well together. Last I checked it is a browser problem.
Using “GET” is a problem too if you need to ajax a lot of data. .
If you are using the ajax to validate a page, a good work around is to open a dhtml iframe window (see http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm) and then do the validation in popup window.
As you are validating, use cfflush to show what’s going on:
Checking value 1: Pass
Checking value 2: Pass
Checking value 3: Fail - date range is not valid.
.
Copy link to clipboard
Copied
In the past, POST and Ajax have not been an issue for me. Even on my own environment (OSX/Apache/CF) this particular scenario works perfectly. I did not encounter this problem until switching my code to the IIS/CF environment. The real problem seems to be CF on IIS when using POST in a cross domain script. Normal Ajax POSTs work fine in the IIS/CF environment when they are not cross domain.
Copy link to clipboard
Copied
Have you posted that same data to your page via an HTML/CF form to verify that your error isn't caused by your page logic?
Copy link to clipboard
Copied
Yes, the POST works fine when the code is in the Apache/CF combination. But when the code is running on the IIS/CF combination, it returns a 500 error. I have a decent amount of experience and I have never seen CF logic cause a 500 error. I am really just trying to go into a 3 step decision tree and return a bit of text. The logic works. Posting to the logic works, until the code is in IIS. I really think there is some sort of permissions or delegation issue between IIS and CF when IIS sees a POST come across from another domain. I just don't know that much about IIS.
Copy link to clipboard
Copied
Just to test the obvious, does *ANY* cfml resource work correctly on the aformentioned IIS/ColdFusion connection?
You have confirmed that ColdFusion is set up properly, correct.
I speak from experience, when recently a newly set up IIS website would only return 500 errors, becasue we had forgot to run the web server connector tool as the final step of configuring IIS and ColdFusion to work together.
Copy link to clipboard
Copied
Yes, I have multiple applications and hundreds of users in constant use of the IIS/CF environment. This particular .cfm is in an application that is running just fine. I have Ajax posts running in all the applications. This is just the first cross domain ajax post I have tried to do to the IIS/CF environment.
Copy link to clipboard
Copied
It was about a year ago when we tried to implement ajax POST that we saw the same 500 error. Ajax GET worked fine, ajax POST had intermittent successes. Sometimes it worked, sometimes it did not. It was bad enough that we had to create a workaround which is still in production today.
I remember googling the error and eventually found a document that confirmed it problem as a bug. It’s been so long that I can’t remember exactly if it said the problem was CF or the browser or apache. (We are CF / Apache / ie and ff).
Wish I could find that doc again…I’ll spend some more time looking…. can you supply the whole error message?
Copy link to clipboard
Copied
I have not found a way to get to the error. The only thing that comes back is the ugly IIS 500 page. There is no verboseness or anything of the sort.
Copy link to clipboard
Copied
I guess there would not be an error message per say. In the onreadystatechange function can you alert the xmlhttp.status if the status is not 200? I’m guessing it will be 500.