[erlang-questions] Nitrogen start page
Jesse Gumm
gumm@REDACTED
Sat Mar 17 12:16:51 CET 2012
Hi John,
Aside from my usual recommendation of "have the proxy deal with it",
the solution would be to roll your own route handler.
I'd say copy the current default route handler from nitrogen to a new
module and modify the results of the route("/") call:
https://github.com/nitrogen/nitrogen_core/blob/master/src/handlers/route/dynamic_route_handler.erl#L57
to be something like:
{static_file, "/index.html"}
You can install this new handler module in your src dir, and then to
make sure nitrogen loads the handler, modify your
src/nitrogen_inets.erl:
...
nitrogen:init_request(RequestBridge, ResponseBridge),
%% Obviously use whatever you name your module
%% instead of my_custom_route_handler
nitrogen:handler(my_custom_route_handler,[]),
nitrogen:run().
Does that make any sense at all or is the late night/early morning
distorting my thoughts?
-Jesse
On Sat, Mar 17, 2012 at 4:31 AM, John Hughes <john.hughes@REDACTED> wrote:
> I'm using nitrogen on inets to serve a mostly-static web site, with a little
> dynamic content here and there. In particular, the first page is
> static--index.html as usual. But when I just browse to the domain name,
> nitrogen uses index.beam to serve the request--and if there is no
> index.beam, then the request fails.
>
> I've hacked around this by providing an index.beam that uses wf:redirect to
> go to index.html, which is then served statically. But this means that the
> browser sees a brief "Redirecting..." message... and perhaps risks Google
> thinking that's what the page contains! Is there a way to configure nitrogen
> so that it uses index.html as the start page directly?
>
> John
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
--
Jesse Gumm
Owner, Sigma Star Systems
414.940.4866 || sigma-star.com || @jessegumm
More information about the erlang-questions
mailing list