0
You guys talking blz? I’m having problems deploying my nuxtjs application to Vercel https://vercel.com/ my problem is that when I make a POST request to my api that is configured in the project (below nuxt.config.js) returns me an error 405. I tried to configure the headers with vercel.json as documentation but could not succeed.
nuxt.config.js
modules: [
// Doc: https://axios.nuxtjs.org/usage
'@nuxtjs/axios',
'@nuxtjs/auth',
'@nuxtjs/proxy'
],
/*
** Axios module configuration
** See https://axios.nuxtjs.org/options
*/
axios: {
proxy: true,
baseUrl: process.env.ENDPOINT_API
},
proxy: {
'/api/': { target: process.env.ENDPOINT_API, pathRewrite: { '^/api/': '' } }
},
vercel.json
{
"headers": [
{
"source": "/(.*)",
"headers": [
{ "key": "Access-Control-Allow-Credentials", "value": "false" },
{ "key": "Access-Control-Allow-Origin", "value": "*" },
{ "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
{ "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }
]
}
],
"env": {
"ENDPOINT_API":"aqui vai a url da api"
}
}
Do
curl -X OPTIONS aqui_vai_a_url_da_api
and check which HTTP verbs are available.– Augusto Vasques
HTTP Status 405 means that you are calling a Resource with an unavailable verb, it checks that the url that is doing the POST is right.
– Giovane