P
P
powerlimit2018-11-25 21:52:16
Vue.js
powerlimit, 2018-11-25 21:52:16

Problems with a Vue project in production?

Hello ladies and gentlemen.
During my development as a front-end developer, I decided to learn vue. started making my first project on vue + vuex + vuetify (and of course webpack).
Everything is beautiful on the girl. animations, other nonsense. I decided to test this case in the sale. uploaded my code to the server.
The main page opens. page transitions are made. but if you refresh the page while on any other link, for example my.site/about, the server returns 404. Who knows how such problems are solved? (I repeat, there is no such problem on the virgin)

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Anton, 2018-11-25
@powerlimit

Here it is directly in Russian in the documentation :

However, there is a problem: since our application is a single page application, without configuring the server properly, we will cause users to receive a 404 error if they go to oursite.com/user/id directly. Now this is not to be called beautiful.
Do not rush to get upset: all you need is a single "backup" entry in the server configuration. If the URL does not match any static file, the server should simply return index.html, which is where our application lives. And again, great!

well, and further configuration examples for different web servers.

A
Alexander Kositsyn, 2018-11-25
@alex_keysi

The config on the server must be set to always give the index.html file.
For any route.
Hash routing done?

P
powerlimit, 2018-11-25
@powerlimit

ErrorDocument 404 / this entry solved all the issues. thanks for the hint.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question