I have a flask app which I want to host it on a subfolder of a website, like example.com/cn.
I configured my nginx like
location /cn {
proxy_pass http://localhost:8000/;
}
So if I access example.com/cn, It will redirect to the index page of flask.
However, I have wrote the routes of other pages on flask like app.route('/a'). So if I click the link of page a, the URI is example.com/a, then nginx cannot redirect it to the right page.
I think I can rewrite all the routes on flask like app.route('/cn/a'), but it's complex. And if someday I want to deploy it on example.com/en, I think I need to rewrite all the routes again.
Does anyone have other methods?