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

JavaFx: including a picture to the left side of a border pane [duplicate]
Using Apache POI to Align Excel Sheet Title
Unable prevent multiple login using the same user name and password using jsf +jpa +oracle
Correct version of class which follows all SOLID Priciples
java.sql.SQLException: null, message from server: “Host 'xxx' is not allowed to connect to this MySQL server”
ConnectException when connecting to server on VM
Find shared library usage
Extracting test data from a generated html file to a xlsx file using selenium java
How to create customized nested MongoDB Query using Morphia?
How to use xjs:simple customization locally
Java - Textbox text not visible
WLS trying to connect to remote server
How to collect entropy sources in JRE(Java Runtime Environment)?
My Code Gets cut and i have no idea why
I am Lost trying to understand how to take in user input into different excel colums.
org.dbunit.database - junit.framework.ComparisonFailure - table ordering is different every run

Categories

HOME
maven
java
bluetooth
google-api-php-client
appx
onedrive
cvs
amortized-analysis
umd
installshield
autotools
user-input
izpack
row
export-to-csv
n-gram
size
leiningen
vaadin7
solaris-10
lucene.net
swiftlint
reverse-proxy
facebook-instant-articles
web-sql
kudan
telerik-reporting
wijmo
emgucv
typo3-6.2.x
elasticsearch-ruby
windows-server-2000
gitignore
r-raster
javascriptcore
ecto
fog
calibre
atl
catalog
scaffold
space-complexity
temporary-files
elasticsearch-plugin
ruby-on-rails-3.1
eigenvalue
node-sass
cubic-spline
strptime
prolog-setof
hendrix
sage-one
rdfs
elgg
boost-preprocessor
nbconvert
google-feed-api
libpng
url-masking
django-debug-toolbar
plottable.js
fputcsv
simplewebrtc
moveit
qcustomplot
make-install
packagist
independentsoft
map-projections
cakephp-3.1
ibaction
lustre
fscommand
sorl-thumbnail
website-monitoring
c3
gadt
relocation
file-copying
googlemock
php-5.4
doskey
aqtime
flash-builder4.5
hamiltonian-cycle
word-processor
blackberry-playbook
javax.script
krl
imac
fluent-interface
icanhaz.js
photoshop-cs4
django-notification

Resources

Database Users
RDBMS discuss
Database Dev&Adm
javascript
java
csharp
php
android
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App