We have a plugin that logs you in and out of a third party service.
Login is easy as we can POST to a controller action, but for logout, we have a link that goes straight to an action URL.
My problem is that I want to redirect back to the URL the user submitted from, with some data that we use in the view (a message to say you've logged out).
redirectToPostedUrl() is no good as this isn't a POST request, and from what I can see in the docs redirect() doesn't give us the option to add data and anything we add in craft()->urlManager->setRouteVariables() doesn't come through when you redirect.
And if we don't redirect or return, we get a 404 as the user is just left on the controller action URL, for which there is no template output.