Hi Folks,
I haven't beat my head against a wall like this in some time. I have a perplexing and maddening problem.
I have googled my brains out for three (3) days.
SYSTEMS INVOLVED:
Initially I was running Win2008 IIS7 with Railo 3.3 over Tomcat & idapi dll that comes with it.
Now, after troubleshooting, I am running the server with Railo 4.0.3 and it's revised IIS connector. (It made not difference with regard to this problem).
I am using Taffy 1.3 beta.
FIRST PROBLEM: I had the problem where the slashes in the query of the URLs was causing blank output in browser and/or other errors when I tested even though it worked in the dashboard mock client.
After searching the net for various fixes and tweaks, I was able to get my API URLs to now work in the browser whether I use the .../index.cfm/... OR the /index.cfm?endpoint= methods.
Of course I was thrilled after two days of hard effort. HOWEVER, much to my chagrin, when I went to test the mobile client application I am developing...
SECOND AND CURRENT PROBLEM: When I make the HTTP Client api request (using Appcelerator's Titanium 3.0 which is javascript based) it comes back with 400 Bad Request with no further detail.
AGAIN, I am using the EXACT same URL on both sides.
- This Works: API URLS entered directly in any PC browser, Mac or Windows
- This Works: The Dashboard Mock Client
- This DOES NOT Work: Taking that same URL and executing via the httpclient methodology in my mobile app on either iOS or Android.
- But This Works: API URLS entered in any mobile device or emulator browser that I have tried. They all work.
- And This Works: Entering other URLs in the mobile app including the dashboard come back with no error in the mobile app. In other words, URLs that don't have slashes in the query string.
NOTE: The same symptom presents using either URL endpoint convention. Same behavior either way.
NOTE: The same symptom presents whether I use the 8888 port to go directly to Railo or whether I go through the standard IIS port 80. Same behavior either way.
WHAT I HAVE TRIED:
- TWEAKS:
- Did various suggestions made online with regarding to the web.config on the IIS side. That helped fixing the first problem but not the second.
- Did various suggestions made regarding the Tomcat INIT tweaks regarding IGNORING slashes in the URI query string. None have had any effect whatsoever.
- Upgraded Railo - had no effect at all.
- Upgraded Taffy - 1.3 has the ability use the endpoint as a parameter but I get the error either way.
- Implemented various URL Rewrites that, again, work in the browser and dashboard mock client but NOT the client app.
- LOGS: View the Trace log for failed URL requests. The problem with this is that it appears to give a lot of detail but when you get down to where the error is, it just says what I already knew: 400 Bad Request although it does say that the "module name" is "ManagedPipelineHandler".
- On Railo 3.3 the log said the error occurred in the connector on the Railo/Tomcat side.
- On Railo 4.0.3 the log says the error occurred in the AspNetHttpHandler.
- Added various HTTP headers thinking that the mobile app was not supplying something that the browser does. None of these made any difference.
- I disabled anonymous authentication in IIS7 and that did return a different error to the mobile app ("unauthorized"). I turned it back on and get the "bad request" again.
- I tried GET and POST, with and without json send parameters.
- I tried other URLs from the HTTPClient tools within the titanium code and those all worked.
- The differences in the web log entries for the various clients are:
- PC Firefox (result 200 OK):
- 2013-03-09 22:37:49 W3SVC1 S15951825 216.250.115.211 GET /api/index.cfm endpoint=/swatchsets/62001 80 - 67.174.76.227 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64;+rv:19.0)+Gecko/20100101+Firefox/19.0 CFID=45e2e1d2-098b-47da-945d-085bd9fa8edd;+CFTOKEN=0;+RAILO_ADMIN_LANG=en;+RAILO_ADMIN_LASTPAGE=services.datasource - swatchman.servatus.biz 200 0 0 3589 461 656
- 2013-03-09 22:38:53 W3SVC1 S15951825 216.250.115.211 GET /api/index.cfm/swatchsets/62001 - 80 - 216.250.115.211 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.22+(KHTML,+like+Gecko)+Chrome/25.0.1364.152+Safari/537.22 RAILO_ADMIN_LANG=en;+RAILO_ADMIN_LASTPAGE=services.datasource;+CFID=e86a500d-5d58-4e7c-8f30-1dc4aa41e33f;+CFTOKEN=0 - swatchman.servatus.biz 200 0 0 3613 540 238
- iPhone Safari (result 200 OK):
- 2013-03-09 22:38:53 W3SVC1 S15951825 216.250.115.211 GET /api/index.cfm/swatchsets/62001 - 80 - 216.250.115.211 HTTP/1.1 Mozilla/5.0+(Windows+NT+6.1;+WOW64)+AppleWebKit/537.22+(KHTML,+like+Gecko)+Chrome/25.0.1364.152+Safari/537.22 RAILO_ADMIN_LANG=en;+RAILO_ADMIN_LASTPAGE=services.datasource;+CFID=e86a500d-5d58-4e7c-8f30-1dc4aa41e33f;+CFTOKEN=0 - swatchman.servatus.biz 200 0 0 3613 540 238
- Mobile App (result 400 Bad Request)
- 2013-03-09 22:41:57 W3SVC1 S15951825 216.250.115.211 GET /api/index.cfm endpoint=/swatchsets/62001 80 - 67.174.76.227 HTTP/1.1 SwatchMan/1.1.0+CFNetwork/609.1.4+Darwin/12.2.0 CFID=1945a41f-9e6a-4ee5-8642-1a80fc5a45bb;+CFTOKEN=0 - swatchman.servatus.biz 400 0 0 257 287 109
IN A NUTSHELL:
- The problem clearly revolves around the "/" (slash) in the query URI convention that is implemented by Taffy and it does not appear to be fully addressed by the new endpoint variation. Again, all that works in the browser but not the app.
- There is obviously some difference between how the server is seeing a straight browser GET versus what the mobile app is sending in terms of either headers or cookies or whatever.
- The problem occurs when either Tomcat is parsing the URL when IIS is preparing it.
- What is so vexing is that the problem appears, for all the world, to be the noted SLASH problem but if that were the case, the same problem would show on the regular browser clients, NO?
- So the fixes I have done have fixed the SLASH problems but not when using a remote mobile app.
I can supply my Titanium javascript code, if necessary, but it is not any different than the hundreds of examples one can google on the net. I have duplicated each minor variation here and there on the next with absolutely NO Effect whatsoever.
I am going to inquire at Appcelerator also and see if they have run into this before. I can't believe they haven't but, for the life of me, I cannot find anything out there about this specific issue.
Thanks to all in advance for any ideas you all may have.
Tom