Timeline for CORS: No "Access-Control-Allow-Origin" header is present on the requested resource
Current License: CC BY-SA 4.0
15 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 2, 2021 at 16:02 | comment | added | SSimion | Yes, the developers have confirmed that the oid is correct and I have checked the inbox for the default lead creator and no emails, unfortunately. They have also confirmed the form action is correct, the fields Ids, etc. Any other ideas? | |
Jul 2, 2021 at 14:32 | comment | added | sfdcfox♦ |
@SSimion "your request has been queued" means it was successfully accepted by Salesforce. You should be getting those leads. Make sure you have an oid parameter for the org Id, and that it is correct (case-sensitive). You should get an email if the oid is correct but you have invalid data, etc.
|
|
Jul 2, 2021 at 10:33 | comment | added | SSimion | I have tried the code myself as html (provided by Salesforce) and it's all working fine. I do have to mention there are no validation rules to stop the Lead from being created in Salesforce. I have suggested to the developers to add the debug code and the initial error was "Your request has been queued" . From your experience, could you please let me know what else could be causing this problem? I have added the origin list to the CORS in Salesforce, the html is working, it's pointing to the correct URL/Sandbox, no validation rules... | |
Jul 2, 2021 at 10:30 | comment | added | SSimion | Hi @sfdcfox. Sorry for having to come back to you on this, but unfortunately the developers are still struggling to get a successful submission in Salesforce and I think I am running out of ideas on what to suggest. And as you are aware, Salesforce doesn't offer support for any type of customization to the code. Since we last touched base - the developers have managed to find some workarounds regarding the CORS and the Leads are passing this point now and reaching the reURL, but they never get created in Salesforce. | |
Jun 17, 2021 at 14:35 | comment | added | SSimion | The initial error message they've sent me was: X Failed to load resource: the server responded with a status of 404 (Not Found) X Access to HMLHttpRequest at 'Salesforce Test environment link from form action Web to Lead Form' from origin '127. . . : ' has been blocked by CORS policy X Failed to load resouce: net: ERR_FAILED | |
Jun 17, 2021 at 14:28 | comment | added | sfdcfox♦ | @SSimion The host is the domain-name part of the Request URL. If the Request URL returns 404, you'd see a 404. | |
Jun 17, 2021 at 14:25 | comment | added | SSimion | Thanks for coming back to me. I agree, but I was running out of solutions to propose to the developer. Sorry, but could you please let me know where that URL they are trying to reach will be? I only have limited info they are sending me. In the new screenshot I can only see host - which it's the test environment. In the previous one I used to see the Request URL. Is this what you mean? I assume it's still 404 error from previously with the localhost. They haven't sent me a new one. | |
Jun 17, 2021 at 14:20 | comment | added | sfdcfox♦ | @SSimion Bypassing by extension won't work--you can't possibly expect everyone who visits your site to install an extension just to submit their data. A 404 error means "file not found"--double-check the URL they're trying to reach, and double-check that the code was deployed to production, if needed. Good news, though, a 404 likely means that they're not experiencing a CORS problem. | |
Jun 17, 2021 at 14:15 | comment | added | SSimion | There is not much info submitting web-to-lead through React and I keep looking where the problem could be considering I can't see more than "Request Headers" I have received. I had a look potentially they might have to bypass the CORS policy and install on extension? What are your thoughts on this? They've passed the error to me to troubleshoot and unfortunately I am not having much luck with this. And unfortunately I can't see anything about error 404. I was expecting an error 403 - as per - developer.salesforce.com/docs/atlas.en-us.chatterapi.meta/… ? | |
Jun 17, 2021 at 14:11 | comment | added | SSimion | I had a reply back that the initial I have received was from their localhost and that the Access-Control-Allow-Origin: * is correct. They've deployed this to prod and I have received a new screenshot from Request Headers: Host: test.salesforce.com Origin: www-companyname-dev.companydevname.com Referer: www-companyname-dev.companydevname.com I had removed what I had initially in the CORS Settings and re-add it the above, but still not working to submit anything. I have tried Chrome, Internet Explorer, Firefox... | |
Jun 17, 2021 at 14:07 | comment | added | SSimion | Thank you for coming back. I've reached out to the developer to potentially set up an HTTPS Local Servers so I can add this in the CORS Settings in Salesforce, as the Access-Control-Allow-Origin: * and it's built on a localhost. | |
Jun 17, 2021 at 2:11 | comment | added | sfdcfox♦ | @SSimion Right, you would need to add something like localho.st to your CORS setting (the path is not considered in CORS requests). The developer would need to rig a (probably self-signed) certificate for testing purposes, and add that cert to their browser's trust chain. The specifics depend on browser and OS, but should be easily found on the Internet. | |
Jun 16, 2021 at 19:05 | comment | added | SSimion | Error: • Invalid protocol in a URL pattern. Origins must use the HTTPS protocol. • Origins may not contain paths or queries, since they are not part of the origin. | |
Jun 16, 2021 at 19:05 | comment | added | SSimion | Thanks for your help with this and your detailed answer. Very much appreciated. I've just gone through and read all the posts on Stack Overflow and after several attempts without any successful submissions, I have just noticed in the Request Headers that "Access-Control-allow-Origin: *" . Does the React developer need to restrict this? I have read pros and cons about this. That's correct. This is only for testing purposes and I did ask the developer to implement captcha for strong security and he did. Still struggling with this, I am not being able to add any origin URl to allowlist. | |
Jun 11, 2021 at 10:06 | history | answered | sfdcfox♦ | CC BY-SA 4.0 |