Skip to main content

How to make a Vue.js single page application (SPA) on Platform.sh

Comments

3 comments

  • modermo

    What about proper redirecting when Vue Router is in ‘history’ mode? I know that Platform has their own way of doing redirects, wondering whether I need to touch the routes.yaml file.

    0
  • Yann Deshayes

    @modermo I think what you want is to add passthru option to the web location YAML object.

    That option will for all the routes to be passed to the index.html, and you can handle that route in your app.

    For example:

    name: app
    type: nodejs:12
    # The configuration of app when it is exposed to the web.
    web:
      locations:
        "/":
          root: "dist"
          index:
            - "index.html"
          passthru: /index.html
    

    Yann

    0
  • modermo

    @ yann-deshayes That works. Thanks for that.

    I would consider including this in the above documentation, as getting History mode for a Vue SPA working on different server environments is a common but somewhat tricky endeavour.

    0

Please sign in to leave a comment.