Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to call Proxy API on server #115

Open
html-helpers opened this issue Feb 28, 2023 · 3 comments
Open

Unable to call Proxy API on server #115

html-helpers opened this issue Feb 28, 2023 · 3 comments

Comments

@html-helpers
Copy link

Hi Team,

I am not able to call proxy url which I setup in target field in nuxt.config.js.

Sample code:

Nuxt.config.js:

modules: [ '@nuxtjs/proxy' ],
proxy: {
'/api/ :{
target: 'some external API Endpoint / URL',
pathRewrite: { '^/api/' : '/' },
changeOrigin: true
}
}

Above setup working fine in localhost, but when I create dist folder and deploy to server and run from the server, it is actually tried to fetch resource from server, not from proxy end point.

Let me know how to fix this issue, so my proxy URL will start working on server.

@joseehilton147
Copy link

same problem

@CHEWX
Copy link

CHEWX commented Apr 12, 2023

Same problem here too. Works locally, not in production. I'm using mode: 'spa' if it helps.

@CHEWX
Copy link

CHEWX commented Apr 12, 2023

Found the problem for me, if using SPA, you cannot run npm run build, it needs to be dev | start on a node.js server. As such it will not work for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants