JRuby/tomcat 404 errors in rseponse to ajax GET - ruby-on-rails

This problem appears specific to routing for JRuby ajax requests. My page sends an ajax GET which works fine in rails development mode. When moved to tomcat via warbler, the request is generated correctly, but tomcat responds with a 404 error.
In other words, the line in routes.rb get '/sector/method' is sufficient that http://localhost:3000/sector/method is processed by Webrick, but if I change the port to 8080 (tomcat) I get a HTTP status 404 The requested resource (/sector/method) is not available.
Apparently tomcat needs to be told it is OK to process the GET even though there is no corresponding file to be found. Right? Fixes?
Thanks.

Are you sure your request point to correct address? if application works, there is no way that GETs does not. Please try to put the request directly into your browser and check...

Related

i want to transfer my ASP.NET MVC project to another server

I want to transfer my ASP.NET MVC project to another server(obvious with different IP address). I transfer the published code there and also map with the same link through IIS (and stop that site from previous server). And also change the connection string with updated database details.
I get this error:
Not Found
HTTP Error 404. The requested resource is not found.
Kindly help.
First of all, you need to figure out whether the request is sending the request to the right server. So please ensure the domain is pointing to the correct IP. Please ensure accessing the website via IP and domain name are getting same response.
If you are sure the request is reaching the right server, then you should see the 404 error in Server IIS log. Please enable failed request tracing and IIS detailed error to find the sub-status code and exception code.
If you see the 404 is returned from static file handler. Then please ensure IIS asp.net extension has been installed so that extensionless handler would help handle the MVC route URL.
If you have already installed asp.net extension. Please post more details and we may find the root cause.

Connection Reset on long urls ($_GET) WAMP

I have an application under Yii, and I have this problem regarding my urls.
With the Yii CGridView, when we filter, the application passes an ajax GET request to the server in a form of a very long url. example:
http://site.com/reports/default/index/MEmailrequestsList%5Bid%5D//MEmailrequestsList%5Bname%5D//MEmailrequestsList%5Bperson%5D//MEmailrequestsList%5Bemail%5D//MEmailrequestsList%5Bcreated%5D//MEmailrequestsList%5Busersender%5D/josalie/MEmailrequestsList%5Bstatus%5D//MEmailrequestsList_page/2/ajax/reportsgrid?ajax=reportsgrid
With Firefox or Chrome's firebug, it doenst show any errors, just a failed status. Upon reviewing, it gives off a status of connection reset.
I am running the application in Windows, under WAMP.
With other urls (non yii) (
http://site.com/samplepage/?id=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1&poads=2&asd=1...
)
I think I did it.
I managed to fix the issue by making the URL of the paginations to use the default get parameter url symbols (? and &). I did this by placing a 'appendParams'=>FALSE to the UrlManager of the application.
It is fixed now and hopefully somebody will find this helpful.

Error 405 on PUTs, "ignoreme.rastahook" in IIS log

We have an Asp.Net application with OpenRasta, and when we deploy it on most of our IISes (7.5), it works fine. In one installation though, for PUT requests, the client receives "405 Method not allowed" errors, and the log shows entries like:
2011-11-15 01:18:20 192.168.0.164 PUT /myapp/ignoreme.rastahook - 80 - 192.168.0.131 AClient 405 0 0 57
ignoreme.rastahook seems to come from OpenRasta's rewriting in OpenRastaModule.cs:
HttpContext.Current.RewritePath(VirtualPathUtility.ToAppRelative("~/ignoreme.rastahook"), false);
The GETs and POSTs work fine though, not sure though if the HTTP method really is what makes the difference. Any idea on what might be going on or where to start debugging? My current guess would be some IIS configuration difference between the working servers and the one that doesn't.
OpenRasta version is 2.0.3, and we run the app on .net 4.
Update:
Fwiw, when changing the verb attribute of the OpenRasta handler mapping from "*" to "GET,POST" in the web.config of my server that works, I get a "ignoreme.rastahook" in the log file as well for the PUTs, but with a 404, not a 405, so that seems to be different from the issue described above.
Update 2
I figured that when I enable WebDAV, I can reproduce the 405 / ignoreme.rastahook issue. Which lead me to https://github.com/openrasta/openrasta-stable/wiki/Installing-OpenRasta-Under-IIS , that states that
please be aware that the WebDAV module can cause problems with IIS 7.5
Update 3
I verified that WebDAV is what caused the problem on that other server, but if anyone knows how to fix the problem without disabling WebDAV altogether, I'd appreciate it.
The problem as you've seen comes from WebDAV. There is no know way that I have found bar adding the entries in your web.config to disable webdav.
This has been added to the wiki page in question.

how to handle errors like 404 / 500 in rails3

Hey, I hope you can help me.
I am trying to find a way to direct the user to the default error pages 404.html and 500.html in my public folder.
So when there is a routing or nomethod error it should be directed there to.
I already tried some stuff in my application controller but it didnt work.
Many thanks!!
Rails does this for you automatically when running in production mode. When you upload your application to a live server, Rails takes care of handling those exceptions and rendering the correct error pages with the correct header status. If you're trying to see what those pages look like (for testing or something), just access them directly via http://localhost:3000/404.html
Whenever you set up your Rails application on a live server (let's use Apache as an example), you give the site root as the /public folder in your application. Then, whenever a request is made to that server address, Apache first looks in that public folder and tries to serve a static asset (this is a configurable option in [environment].rb). If it can't find the requested page, then the request is forwarded through the Ruby stack.
When in production mode, if Rails encounters an error that isn't handled (i.e begin, rescue), it throws the error the whole way up to the stack, which then tells Apache (again, in my example) to render an appropriate error.
Here are some common errors that you'll see in development mode and what they render in production mode:
ActiveRecord::RecordNotFound => 404 (page not found)
nil.method => 500 (server error) unless you turn off whiny nils
ActionController::RoutingError => 404 (page not found)
Happens automatically if run in production mode - no need that you do that manually.
Have a look at this post to redirect all requests causing a Routing Error.

Any ideas how to troubleshoot HTTP Error 400 for MVC/Firefox?

Two clients complains on HTTP Error 400 from Mozilla Firefox 3.6.9. This happens when they open any link - both mvc application and also any static images, which are hosted on Classic application pool without any code.
Exact error message is HTTP Error 400. The request is badly formed
No errors in windows log and application error log. Proxy in browser is set to off.
Other browsers works fine for them.
Any ideas about what could cause such behavior?
For now, i can see only one option - ask them to install Firebug, but this is not really user friendly.
For some reason, cookies was corrupted and this was leading to HTTP 400 error.
After user cleaned cookies for this website he was able to get page.
I still need to investigate what exactly went wrong and find source of this problem but it is clear that I need to review all places where I do cookie creation.

Resources