You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have nuxt frontend and api backend on 1337 port.
I'm trying to proxy http://*nuxtapp*/api/* requests to http://localhost:1337/
Example http://*nuxtapp*/api/products to http://localhost:1337/products
When I'm using API_URL env var, as was mentioned here or here (as 'already practiced solution') then my requests are proxies to http://localhost:1337/api/products instead http://localhost:1337/products
But if I change var name to something another, like API_TARGET then it works as expected.
when I set config.axios.baseUrl then config.proxy stop working at all.
from axios official docs: Environment variable API_URL can be used to override baseURL
from axios official docs: WARNING: baseURL and proxy cannot be used at the same time
Okay, if I understand, using baseURL or API_URL totally disabling proxy feature (or, pathRewrite feature, like in this case) and I have to use any another env var. But why it works in mentioned cases (links on top of this letter)? Or, what I exactly need to do in this case?
The text was updated successfully, but these errors were encountered:
I have nuxt frontend and api backend on 1337 port.
I'm trying to proxy
http://*nuxtapp*/api/*
requests tohttp://localhost:1337/
Example
http://*nuxtapp*/api/products
tohttp://localhost:1337/products
When I'm using
API_URL
env var, as was mentioned here or here (as 'already practiced solution') then my requests are proxies tohttp://localhost:1337/api/products
insteadhttp://localhost:1337/products
But if I change var name to something another, like
API_TARGET
then it works as expected.nuxt.config.js:
I already looked around this problem:
config.axios.baseUrl
thenconfig.proxy
stop working at all.Environment variable API_URL can be used to override baseURL
WARNING: baseURL and proxy cannot be used at the same time
Okay, if I understand, using
baseURL
orAPI_URL
totally disablingproxy
feature (or,pathRewrite
feature, like in this case) and I have to use any another env var. But why it works in mentioned cases (links on top of this letter)? Or, what I exactly need to do in this case?The text was updated successfully, but these errors were encountered: