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


Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Bookmarks
  • Search
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

Cloudron Forum

Apps | Demo | Docs | Install
  1. Cloudron Forum
  2. Surfer
  3. Request: Support for HTML5 History

Request: Support for HTML5 History

Scheduled Pinned Locked Moved Surfer
5 Posts 4 Posters 1.0k Views 4 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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
    0
    • nebulonN Away
      nebulonN Away
      nebulon
      Staff
      wrote on last edited by
      #2

      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 😄 )

      fbartelsF 1 Reply Last reply
      0
      • nebulonN nebulon

        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 😄 )

        fbartelsF Offline
        fbartelsF Offline
        fbartels
        App Dev
        wrote on last edited by
        #3

        @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
        0
        • girishG Offline
          girishG Offline
          girish
          Staff
          wrote on last edited by
          #4

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

          1 Reply Last reply
          1
          • ? Offline
            ? Offline
            A Former User
            wrote on last edited by
            #5

            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
            1
            • nebulonN nebulon marked this topic as a regular topic on
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Bookmarks
            • Search