No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Browser refresh on spa build served by Caddy does not reload spa root route unlike dev server

    Help
    1
    2
    580
    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.
    • D
      dgk last edited by

      I am finding a difference in behavior between when the user clicks browser refresh/reload (or enters via non root route) for a built spa (served by Caddy) vs the quasar dev server.

      In the later the quasar dev server reloads the root route vue component (i.e. the q-layout) but in the former this does not happen thus breaking the site

      I have to imagine this issue has come up for serving a built SPA with several routes so what is the solution? One ugly idea I had was to trap the refresh and redirect to the root route per this https://stegosource.com/prevent-browser-refresh-url-changes-route-navigation-vue/

      Another is to bail on builds all together and use the dev server for production which will be the least painful.

      I’ve tired to get the Caddy server to address this but that is not possible.
      https://caddy.community/t/reload-rewrite-to-root-on-browser-refresh-v2

      I’m using the latest quasar/app framework (as of 5-19.20) although I’ve had this issue for going back awhile but now I have a “real” production situation coming up and I need a solution. I can’t have the user break the site by clicking refresh or entering on a non-root route.

      1 Reply Last reply Reply Quote 0
      • D
        dgk last edited by dgk

        The folks at Caddy helped me figure this out for Caddy V2 so I’ll share it as there is only an nginx example in quasar docs

        https://lights.xxx.net {
            import r53
            root * /opt/lights/web
            handle /socket.io/* {
                reverse_proxy http://lights.net:3030
            }
            handle {
                try_files {path} {path}/ /index.html
                file_server
            }
        }
        

        https://caddy.community/t/reload-rewrite-to-root-on-browser-refresh-v2/8276/11?u=dkebler

        1 Reply Last reply Reply Quote 0
        • First post
          Last post