laravelvue.jsviteamazon-cloudfrontlaravel-vapor

laravel vapor is injecting cloudfront cdn url between app domain and vue route url


I am using Laravel Vapor to deploy my laravel/vue application and using vite to compile assets.

The deployment is working perfectly and assets are being loaded from CloudFront CDN but vapor is also injecting CloudFront asset url (https://a.cloudfront.net) to browser url after main domain (https://example.com) and vue route (/login)

Here is a url that it is redirecting: https://example.com/https://a.cloudfront.net/login

How do I make it as https://example.com/login ?


Solution

  • I fixed this problem myself. The problem was a vue router file:

    const router = createRouter({
      history: createWebHistory(import.meta.env.BASE_URL),
      .
      .
    

    I changed it to

    const router = createRouter({
      history: createWebHistory('/'),
      .
      .
    

    and the problem solved.