proxy not work in nginx server
[issue link]Nuxtjs: 1.0.0 RC11
= @nuxtjs/proxy : latest
I had build my spa page very well, and there’s a third party API request using axios in my page.
When i run it from localmachine , everything is fine.
But after i move the generate files using nuxt generate into nginx server. I found that the proxy request cannot parse with 404 returned.
the proxy i had configured in my nuxt.config.js file like below:
modules: [
['@nuxtjs/google-analytics', { ua: 'UA-78501857-4' }],
'@nuxtjs/axios',
'@nuxtjs/proxy'
],
axios: { debug: true },
proxy: {
// /api/test1/test2 -> http://www.toutiao.com/api/test1/test2
'/api': {
target: 'http://www.toutiao.com',
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
logLevel: 'debug'
}
},
-
The axios request url is : http://www.toutiao.com/api/pc/feed/?min_behot_time=0&category=all&utm_source=toutiao&widen=1&tadrequire=true&as=A105A9CB66F96E6&cp=59B609C66E464E1
-
The proxy url had become: http://localhost:3030/api/pc/feed/?min_behot_time=0&category=all&utm_source=toutiao&widen=1&tadrequire=true&as=A105A9CB66F96E6&cp=59B609C66E464E1
-
In nginx server I saw the request is http://servername.com/api/pc/feed/?min_behot_time=0&category=all&utm_source=toutiao&widen=1&tadrequire=true&as=A105A9CB66F96E6&cp=59B609C66E464E1 , but it returned as 404.