[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gb.web WebPage.Render problem on Apache


On 3/25/24 22:31, T Lee Davidson wrote:
Well it's not just Apache. Lighttpd behaves that way too. I think I was deceived by how well it worked with gb.httpd.

The application serves the MainPage for every request because ... that's what I have told it to do. Duh.

So the question now is, how can I use a Module as a router to decide what WebPage to serve and just hand the processing off to that WebPage? Or is that not possible, and I would have to parse and handle every request?

I tried this:
[code]
Public Sub Main()

   If IsNull(Request.Path) Or If Request.Path = "/" Then
     MainPage.Render
   Else ' Let the WebPage handle everything else
   Endif

End
[/code]

but I got a 500 Internal Error: "End of script output before headers"

Although it needs to be more intelligent and robust, this works:
[code]
Public Sub Main()

  If IsNull(Request.Path) Or If Request.Path Ends "/" Then
    MainPage.Render
  Else
    Response.SendFile("./.public" &/ Request.Path)
  Endif

End
[/code]


--
Lee

--- Gambas User List Netiquette [https://gambaswiki.org/wiki/doc/netiquette] ----
--- Gambas User List Archive [https://lists.gambas-basic.org/archive/user] ----


References:
gb.web WebPage.Render problem on ApacheT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: gb.web WebPage.Render problem on ApacheT Lee Davidson <t.lee.davidson@xxxxxxxxx>
Re: gb.web WebPage.Render problem on ApacheT Lee Davidson <t.lee.davidson@xxxxxxxxx>