java


Error pages in Grails app hosted using IIS 7 / Tomcat connector


I have a Grails application that is running in Tomcat 7 under IIS 7, using the Jakarta Isapi Tomcat connector version 1.2.30 and I'm having trouble getting the error handling to behave how I'd like. The Tomcat connector is configured in uriworkermap.properties to forward all requests below the application's URL to Tomcat:
/OrderSubmission/* = worker1
The Grails application has its own custom error pages which work fine when the application is running on a development machine without IIS / the Tomcat connector, but when on the server, if custom error pages are switched on in IIS, these always override the ones in the Grails application. This means that where I have a specific page to handle a certain exception type, e.g. in UrlMappings.groovy:
"500"(controller: 'error', action: 'itemNotFound', exception: ItemNotFoundException)
...I'm instead seeing the static 500 error page that I've pointed IIS at.
If I instead turn on detailed errors in IIS I get the correct error pages through from my Grails application - however, if a request is made for a URL outside of the application's context, I then see the detailed IIS 404 page, which is unacceptable. If I change the Tomcat connector's uriworkermap.properties to include everything from the root downwards then I instead see a default Tomcat 404 error page. I've tried getting the Tomcat connector to default to custom pages by setting the error_page option in isapi_redirect.properties to point to my IIS static custom pages like so:
error_page=/%d.htm
...but this doesn't work, and I can't find any example of using this setting anywhere.
What I need to happen is for the custom Grails error pages to be shown - unless the URL being requested is outside the application or the application is down, at which point I need custom static error pages to be shown.
Has anyone managed to achieve this?
TIA
I ended up making my error page controller methods return a status of 200 (OK), unless dealing with an AJAX request:
class ErrorController {
def pageNotFound() {
if (!request.xhr){
response.status = 200
}
}
}
IIS is set to 'Custom error pages'.
This prevents IIS stepping in and providing the custom static pages that I provide, unless the requested URL is outside the scope of the Grails application.
The error status is retained for AJAX requests in order to allow the caller to properly deal with the result.
I'm unsure whether it's satisfactory practice to return 200 from the application on error, particularly with regard to search engines - however it seems that even without this change, when an error occurs and the response is ultimately returned to the browser from IIS it has a status of 200, according to Fiddler.

Related Links

Junit - method at the end of each test
Moving custom menuManager at the end of existing RCP app menu
IceFaces extended request scope thread safety
#Async not asynchronous in Groovy
Java: Object reference inside Object that contains original Object reference
Reading large number of bytes from GZIPInputStream
Spring mongodb: Aggregation unable to specify graphLookup.maxDepth
How to pass object from superclass constructor in Java?
Why is restassured MockMvcRequestSpecification returning empty response body?
Run ANT file within the same workspace JRE
how can i store the value from iterator to a local variable?
Spring Boot Multiple File Upload Causes Sporadic Parsing HTTP Request Header Error
java.lang.NoClassDefFoundError: org.openqa.selenium.htmlunit.HtmlUnitDriver
Unable to align chat messages according to the sender in RecyclerView
Querydsl - Exception in thread “main” java.lang.IllegalArgumentException: No sources given
java.io.FileNotFoundException: (Operation not permitted) error with ./keytool -import on mac osx (el capitan) - Java 6

Categories

HOME
blogger
gerrit
plot
spagobi
cvs
rsync
setup-deployment
tizen-web-app
electronics
jgroups
echarts
medical
vault
midi
commonmark
circuit
iolanguage
clearcase-ucm
graphlab
highlight.js
google-static-maps
samoa
wkwebview
core-text
emgucv
tdd
url-scheme
traffic
maquette
msys2
nat
lightswitch-2013
lxd
rotational-matrices
cloud-code
wpf-controls
splice
opshub
cookiecutter-django
http-redirect
acoustics
qcombobox
galleria
taffy
apache-fop
winscp-net
lowpass-filter
colorama
flutterwave
arrow-keys
sqldf
mcafee
dynamics-sl
smart-table
nested-sets
google-feed-api
savon
trash
prettytensor
make-install
yaws
suffix-tree
system.management
energy
marching-cubes
cyclomatic-complexity
wireshark-dissector
tarjans-algorithm
dukescript
vstest.console.exe
angular-local-storage
truevault
hyprlinkr
didselectrowatindexpath
srs
centos5
fmod
spring-io
jquery-mobile-dialog
xamlparseexception
spring-validator
robotics-studio
clipper
factory-method
runas
labwindows
objective-c-2.0
chrono
osql
xmlspy
gdlib
floating
digest-authentication
coda-slider
mirah
javap
ubuntu-9.04
mdac
paul-graham
3gp
rtml

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App