B4J Question CORS error. Response to preflight request doesn't pass access control check: It does not have HTTP ok status

coldflame

Member
Good Afternoon Everyone,
Am working on a project using B4J and Nuxt JS. And I encountered a CORs error. I checked the forum and found https://www.b4x.com/android/forum/threads/banano-b4j-the-dreaded-cors-exception-solved.141890/#post-899673. However I am still getting the CORs error(Some request go through successfully). Here are some attached screenshots for context

This is the B4J Code
Screenshot from 2024-03-02 12-01-01.png

This request goes the server successfully
1709378223626.png


This request fails for the CORs check
1709378303654.png

This is the log from the console for the failed request
1709378348521.png


Please Help
Thanks.
 

alwaysbusy

Expert
Licensed User
Longtime User
I suppose you have also done the first part from that post, that is using a CORS filter. We had a similar thing a couple of weeks ago on our DEV server and we had to change this line to explicitly mention all the domains instead of using "*".

B4X:
' ConfigureCORS(srvr, "/*", "*", "*", "*") ' did not work anymore
' to:
ConfigureCORS(srvr, "https://api.wittouck.eu,https://work.wittouck.eu,http://localhost", "*", "*", "*")

Alwaysbusy
 
Upvote 0
Top