Cloudron makes it easy to run web apps like WordPress, Nextcloud, GitLab on your server. Find out more or install now.


    Cloudron Forum

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular

    Unsolved Request: Support for HTML5 History

    Surfer
    4
    5
    206
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • ?
      A Former User last edited by

      I’ve noticed that using dynamic routes on a static Vue SPA poses a problem because technically the routes don’t contain index.html files for them. If I navigate within my site, it works. If I go to, for example, https://atridad.dev/post/1, it doesn’t work at all. Is this something we can have added or is there something I’m missing in config?

      @staff

      1 Reply Last reply Reply Quote 0
      • nebulon
        nebulon Staff last edited by

        I am not sure I understand what the issue and the expected behavior is.

        So my guess is, you have a client side app which is at the root, some index.html there will be served up. Now further you navigate and your (in this case vue) app doesn't use a hash style navigation, but overloads the browser location with paths, which are just known to the app?

        If this is the case, then the only thing I can think of is to somehow add a config option to surfer, which essentially means it will always server up a specified file, regardless of the path, if we hit otherwise a 404? I guess somehow this can already made to work if you rename your index.html to 404.html (quite the strange workaround if that works and is what you expected of course 😄 )

        fbartels 1 Reply Last reply Reply Quote 0
        • fbartels
          fbartels App Dev @nebulon last edited by

          @nebulon said in Request: Support for HTML5 History:

          I guess somehow this can already made to work if you rename your index.html to 404.html

          That could actually work.

          The challenge with single page apps is that you need rewrite rules to make requests to /somepath/page actually be handled by your index.html.

          1 Reply Last reply Reply Quote 0
          • girish
            girish Staff last edited by

            I guess we need a "default handler" which is functionally same as 404 page.

            1 Reply Last reply Reply Quote 1
            • ?
              A Former User last edited by

              I haven't actually chimed in on this since posted I guess. Whoops...

              Yeah my ask would maybe be the ability to add redirects based on status codes. As was mentioned, for example, any 404 could route to index.html (or any file one wants to specify). Just gives more options. Like this in cloud front, for instance:
              Screen Shot 2022-03-18 at 2.18.11 PM.png

              1 Reply Last reply Reply Quote 1
              • First post
                Last post
              Powered by NodeBB