Vue Router and AWS Amplify

19 Views Asked by At

I am deployed to aws amplify with a vue front end. I am trying to add vue router to the application. The vue router works great locally, but there is an issue when deploying to aws amplify.

The page at the route (domain.com/) works great. But if I add a route the end (domain.com/admin) I am getting a 404. I believe it make be an issue with the App Build Config Yaml

version: 1
frontend:
  phases:
    preBuild:
      commands:
        - npm ci
    build:
      commands:
        - npm run build
  artifacts:
    baseDirectory: dist
    files:
      - '**/*'
  cache:
    paths:
      - node_modules/**/*
  customHeaders:
    - pattern: '**/*'
      headers:
        - key: 'Cache-Control'
          value: 'no-store'
  rewrites:
    - source: '**'
      destination: '/index.html'

Any help would be appreciated!!

I also tried a few different settings for the rewrites.

  rewrites:
    - source: /<*>
      destination: '/index.html'
  rewrites:
    - source: '/<*>'
      destination: '/index.html'
0

There are 0 best solutions below