@rvanwoezik Thanks for your snippit for the url rewrite.
I found that there was a problem with the routing because the server that is hosting the application is in another domain that is not trusted. This caused some redirects to fail.
Thanks for the quick reply.