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

Problem with ssr Cors then axios and proxy #582

Open
Rileyjrjohns opened this issue Jul 13, 2022 · 0 comments
Open

Problem with ssr Cors then axios and proxy #582

Rileyjrjohns opened this issue Jul 13, 2022 · 0 comments

Comments

@Rileyjrjohns
Copy link

Rileyjrjohns commented Jul 13, 2022

Hello,

I had problems yesterday that I never had on previous nuxt projects.

I have indeed read that it was necessary to set the proxy to solve the problem. Despite this, I have a 504 error. I followed several solutions found on the github repository without having found the problem.

My post function

await this.$axios.post("/api/contact", { replyTo: this.form.email, name: this.form.name, firstName: this.form.firstName, phone: this.form.phone, company: "", message: this.form.message, }).then(() => { this.isSend = true; }) .catch((e) => { console.log(e); this.isError = true; });

My nuxt config

modules: ["@nuxtjs/axios", "@nuxtjs/proxy"], axios: { proxy: true, debug: true, }, proxy: { "/api/": { target: "http://myserver.eu-west-3.elasticbeanstalk.com/", pathRewrite: { "^/api/": "" }, changeOrigin: true, }, },

my api call need to be done on http://myserver.eu-west-3.elasticbeanstalk.com/contact

I'm pretty sure I made a mistake somewhere, but I really can't find where...
Capture d’écran 2022-07-13 à 10 33 15

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

1 participant