Menu

Path based routing - 404

How-To
Joe
2024-12-27
2025-01-06
  • Joe

    Joe - 2024-12-27

    How does the path based routing work, for example, with Tea Sampler?
    How come can I put https://frequal.com/tea-sampler/buttons in the URL bar and it will load the Buttons page? When in the network debugger it shows a 404 for /buttons.

    I'm trying Flavour out in a local demo application, and I just get the 404 not found response when trying to navigate directly to one of my routes by entering the path directly. Navigating by a button event and Routing.open() works fine.

     
  • linuxfun

    linuxfun - 2025-01-04

    I assume that the teasampler uses an HTTP server, that serves the index.html from the root of the deployment when a subpath is requested, that does not exist physically. That is doable with Apache, but also using a servlet (the latter requiring you to implement it).
    The HTML code is served as the body of the 404 response. Why no 200 is used is beyond me.

     
  • Andrew Oliver

    Andrew Oliver - 2025-01-05

    The web app must redirect 404 to the application home page, allowing routing to work for alternate paths.

    Add this in your web.xml:

      <error-page>
        <location>/</location>
      </error-page>
    

    This should be in the Flavour archetype, I'll make a ticket to add it there to save a step. Thanks for pointing this out.

     
  • Andrew Oliver

    Andrew Oliver - 2025-01-06

    I've added this info to the Flavour book, section 7.3.2:

    https://frequal.com/Flavour/book.html

     

Log in to post a comment.