Blob Blame History Raw
diff --git a/mod_auth_mellon.c b/mod_auth_mellon.c
index 3d44460..36a3184 100644
--- a/mod_auth_mellon.c
+++ b/mod_auth_mellon.c
@@ -204,6 +204,12 @@ static int am_create_request(request_rec *r)
 
 static void register_hooks(apr_pool_t *p)
 {
+    /* Our handler needs to run before mod_proxy so that it can properly
+     * return ECP AuthnRequest messages when running as a reverse proxy.
+     * See: https://github.com/Uninett/mod_auth_mellon/pull/196
+     */
+    static const char * const run_handler_before[]={ "mod_proxy.c", NULL };
+
     ap_hook_access_checker(am_auth_mellon_user, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_check_user_id(am_check_uid, NULL, NULL, APR_HOOK_MIDDLE);
     ap_hook_post_config(am_global_init, NULL, NULL, APR_HOOK_MIDDLE);
@@ -219,7 +225,7 @@ static void register_hooks(apr_pool_t *p)
      * Therefore this hook must run before any handler that may check
      * r->handler and decide that it is the only handler for this URL.
      */
-    ap_hook_handler(am_handler, NULL, NULL, APR_HOOK_FIRST);
+    ap_hook_handler(am_handler, NULL, run_handler_before, APR_HOOK_FIRST);
     return;
 }