2

So I have finally deployed my full stack Java Spring Boot app (my backend server) and frontend on Render, with database runing on Railway.

Here is the link: https://shoppinglistapp-k7td.onrender.com/

My problem is the app runs fine on my local machine but after delpoyed, almost all the buttons that I clinck lead to a "Not Found" page. I have to go back, refresh, click the button again to see the content.

For example, after logging in, if you click logout, it should take you back to the login page but instead, it takes you to a "Not Found" page. You have to go back and refresh, otherwise the login page wont load.

I am only a recent graduate and I would love to get some help.

I have tried upgrading my free Render webservice to a paid plan as I thought it was because the server was responding too slow, but the problem remains.

const router = new Router({
  mode: 'history',
  base: process.env.BASE_URL,
  routes: [
  {
      path: '/',
      name: 'home',
      component: Home,
      meta: {
        requiresAuth: true
      }
    },
    {
      path: "/login",
      name: "login",
      component: Login,
      meta: {
        requiresAuth: false
      }
    },
    {
      path: "/logout",
      name: "logout",
      component: Logout,
      meta: {
        requiresAuth: false
      }
    }
 ]
})
Jay Wu
  • 23
  • 4
  • I tried your web app. Something looks buggy in the way you have routed your login page. I believe the issue is present in the login page only. Can you please post the code snippet of how you are routing to the pages? – Saarthak Gupta Feb 09 '23 at 03:04
  • @SaarthakGupta this happens to all the actions that I do in my App actually. I just added the routing codes – Jay Wu Feb 09 '23 at 03:18

1 Answers1

1

I believe this is due to the configuration of the front-end server (nginx or Apache etc...) on which you have deployed your Vue app. That's the reason, it is working on your local & not working when you deploy it. You might need to configure your frontend deployed server configuration.

Please check this link out: Vue Router return 404 when revisit to the url

I can help you out more if you provide me with your deployed frontend server details.

Saarthak Gupta
  • 396
  • 2
  • 9
  • 1
    I just checked the hosting service you are using i.e. render. Did you try this out? https://render.com/docs/deploy-vue-js#using-client-side-routing – Saarthak Gupta Feb 10 '23 at 09:04
  • No, but I just tried it and the site is working perfectly now!! thank you so much! – Jay Wu Feb 11 '23 at 02:54