POST Request blocked by CORS, alrdy allow CORS, spring boot with react project

I'm Working on mockup e-commerce use react and spring boot, and I got stumble on register page. Been trying to make api call to spring boot but got blocked by CORS policy, it quite strange bcz I already allow my local url on CORS policy before (got blocked by CORS when try to GET data from api, but fixed it) and somehow when I try to make POST request it got blocked. here my repo: https://github.com/W-ptra/dummyShop register page: https://github.com/W-ptra/dummyShop/blob/main/frontend/src/pages/Register.tsx allow cors proof 1: https://github.com/W-ptra/dummyShop/blob/main/backend/src/main/java/com/dummyShop/dummyShop/configuration/SecurityConfiguration.java (go to the bottom) allow cors proof 2: https://github.com/W-ptra/dummyShop/blob/main/backend/src/main/java/com/dummyShop/dummyShop/configuration/WebConfig.java allow cors proof 3: https://github.com/W-ptra/dummyShop/blob/main/backend/src/main/java/com/dummyShop/dummyShop/controller/AuthenticationController.java Hope the provided information is enough, thanks
GitHub
GitHub - W-ptra/dummyShop: Mock up e-commerce shop backend system b...
Mock up e-commerce shop backend system build using java spring boot - W-ptra/dummyShop
GitHub
dummyShop/frontend/src/pages/Register.tsx at main · W-ptra/dummyShop
Mock up e-commerce shop backend system build using java spring boot - W-ptra/dummyShop
GitHub
dummyShop/backend/src/main/java/com/dummyShop/dummyShop/configurati...
Mock up e-commerce shop backend system build using java spring boot - W-ptra/dummyShop
GitHub
dummyShop/backend/src/main/java/com/dummyShop/dummyShop/configurati...
Mock up e-commerce shop backend system build using java spring boot - W-ptra/dummyShop
GitHub
dummyShop/backend/src/main/java/com/dummyShop/dummyShop/controller/...
Mock up e-commerce shop backend system build using java spring boot - W-ptra/dummyShop
No description
12 Replies
JavaBot
JavaBot2mo ago
This post has been reserved for your question.
Hey @miporin1780! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here. 💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
miporin1780
miporin1780OP2mo ago
Update: after few days I figure it out by use proxy on my react and bind the ip address and port same as the spring boot, with this the POST request now can pass and not block by CORS. tbh, I am quite not satisfy with the method, and I still open for a way or a solution how to allow the POST request to pass without enabling proxy.
ayylmao123xdd
ayylmao123xdd2mo ago
can you paste the code where it allows cors cant open git rn
miporin1780
miporin1780OP2mo ago
No description
miporin1780
miporin1780OP2mo ago
No description
miporin1780
miporin1780OP2mo ago
No description
JavaBot
JavaBot2mo ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
miporin1780
miporin1780OP2mo ago
The issue is solved
JavaBot
JavaBot2mo ago
If you are finished with your post, please close it. If you are not, please ignore this message. Note that you will not be able to send further messages here after this post have been closed but you will be able to create new posts.
miporin1780
miporin1780OP2mo ago
create this bean
No description
miporin1780
miporin1780OP2mo ago
and slap it right at cors( .... ) method
No description
JavaBot
JavaBot2mo ago
Post Closed
This post has been closed by <@541246766872526859>.

Did you find this page helpful?