-
Notifications
You must be signed in to change notification settings - Fork 2
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
fix cors and requestData errors #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you check if the destination is encoded correctly?
return [ | ||
{ | ||
source: '/api/v1/:path*', // Match all routes starting with /api/v1/ | ||
destination: 'http://localhost:8080/api/v1/:path*', // Proxy to backend server |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the http://localhost:8080
prefix should be hardcoded. Is it possible to just use the remaining suffix?
Granted, I don't know next.js, but this seems off.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is how the nextJS rewrites to an external server work. If I try to replace the hardcoded url with an env variable then I get a 500 internal server error.
Here is the rewrite docs: https://nextjs.org/docs/pages/api-reference/config/next-config-js/rewrites#rewriting-to-an-external-url
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine to me now.
Tested it with the container PR, and the frontend works and pulls the javascript sources.
}; | ||
|
||
try { | ||
const response = await axios.post( | ||
'http://localhost:9000/api/tx/programmable-token/issue', | ||
'/api/v1/tx/programmable-token/issue', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this looks more like a route I would expect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is the direct api call not the rewrite.
As mentioned on slack, the solution of the conflict is to still delete |
-reapplied the rewrites to the next.config.js file
-fixed the issues with the requestData