I use ocsigen-start 2.4 with eliom 6.7, and I would like to modify the app so that it always redirect to a landing page if an unconnected visitor tries to access another service.
As most services seems to be registered with
App_name_page.Opt.connected_page, it seems appropriate to me to modify app_name_page.eliom to program expected behavior. I see there http://ocsigen.org/ocsigen-start/dev/api/server/Os_page.Make.Opt that default connected_page of Os_page.Make.Opt has following signature
val connected_page : ?allow:Os_types.Group.t list -> ?deny:Os_types.Group.t list -> ?predicate:(Os_types.User.id option -> 'a -> 'b -> bool Lwt.t) -> ?fallback:(Os_types.User.id option -> 'a -> 'b -> exn -> Os_page.content Lwt.t) -> (Os_types.User.id option -> 'a -> 'b -> Os_page.content Lwt.t) -> 'a -> 'b -> Html_types.html Eliom_content.Html.elt Lwt.t
So I imagine I can get the behavior I want as follow:
- Set default_predicate _ _ to Lwt.return_false inside Page_config module of app_name_page.eliom (I guess it denies all ressources by default)
- Define a connected_page with ~allow:list_of_services_I_allow_access_to_any_visitor and ~fallback: (fun _ _ _ _ -> some_default_content_to_display_when_an
Is that something that makes sense regarding what I want to achieve or am I completely misleading ?
Thanks a lot for your advice!