C
C
camradee2022-03-25 18:58:32
Nginx
camradee, 2022-03-25 18:58:32

How to configure a nuxt application in a subdirectory of an existing site with language support?

That is, there is a nuxt posts application at sitename/posts, it is necessary that the languages ​​work - sitename/ru/posts, sitename/en/posts.
The problem is that the nuxt documentation states that for an application launched as part of another site, you need to register router base, in my case,
router: {
base: '/'posts/,
},
Everything works, but as soon as the language is added, it redirects on sitename/posts/ru/posts
In theory, some kind of dynamic rooting is needed, but only a string is allowed in base. Nginx config:
location ~* ^(/(en|ru))?/posts {
expires $expires;

proxy_pass 127.0.0.1:3000 ;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 1m;
proxy_connect_timeout 1m;
}
How it can be implemented?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question