Heroku(Nuxt) to heroku(rails) access to 404

Asked 1 years ago, Updated 1 years ago, 117 views

I can communicate from local (Nuxt) to heroku (rails) without any problems, but
When I try to access heroku(rails) from heroku(Nuxt) with axios, I get 404 error.
I think there is no problem with setting the cors on the rails side.
I could see that it is 404 in the Heroku log on the Nxt side.
I have also confirmed that the request has not arrived in the rails log.
When I got it with the API test tool, it came off normally, so I think it's Nxt's setting.
I will write the proxy settings below.

proxy:{
    '/rails': {
      target: 'https://myapp.herokuapp.com',
      pathRewrite: {
        US>'^/rails': '/'
      }
    }
  },

If you know anything, please let me know.

ruby-on-rails heroku nuxt.js axios

2022-09-29 22:16

1 Answers

I solved myself.

in axios configuration
axios:{
    baseURL: 'https://myapp.herokuapp.com'
  },

When I removed the proxy as , the request was successfully passed.
What happens to CORS without proxy?
I have some questions left, but I am writing to let you know that it has been resolved.


2022-09-29 22:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.