Sorry if this is a rehashed issue. I searched around and couldn’t find anything that struck a chord with my situation.
Your software
My Mautic version is: 4.0
My PHP version is:7.4
My Database type and version is:
Your problem
My problem is: Manual entry form submits, submit data but fail to report back in the UI that the form was sent. I am getting what I think is a CORS error and can’t figure out how to edit the htaccess to allow for the subdomain to access properly. Oddly enough, using the WordPress Mautic plugin avoids this problem.
I need to add the form code manually as I need to trigger a script to allow for Google Ads conversion tracking with an onsubmit. It’d be nice if there was a way we could add that function directly in Mautic and still use the WP Plugin.
torontoheadshot.com > Main site with form
marketing.torontoheadshot.com > Mautic install
In Mautic, under CORS, I have both domains added on separate lines using the same protocol.
I found this code for the htaccess file on the main site but it still doesn’t work.
SetEnvIf Origin ^(https?://(?:.+\.)?torontoheadshot\.com(?::\d{1,5})?)$ CORS_ALLOW_ORIGIN=$1
Header append Access-Control-Allow-Origin %{CORS_ALLOW_ORIGIN}e env=CORS_ALLOW_ORIGIN
Header merge Vary "Origin"
These errors are showing in the log:
Chrome console
POST https://marketing.torontoheadshot.com/form/submit?formId=1&_gl=1*1k96bcj*_ga*MTU2Mzk1MzM3OC4xNjIzNjgwNjU5*_ga_CV7J0KBEG0*MTYzMjk0MzExMS44LjEuMTYzMjk0Nzg0MC4w 500
Uncaught DOMException: Blocked a frame with origin "https://marketing.torontoheadshot.com" from accessing a cross-origin frame.
at HTMLDocument.<anonymous> (https://marketing.torontoheadshot.com/media/js/app.js?vadf2fdae:271:162)
at mightThrow (https://marketing.torontoheadshot.com/media/js/libraries.js?vadf2fdae:355:18)
at process (https://marketing.torontoheadshot.com/media/js/libraries.js?vadf2fdae:357:89)
(anonymous) @ libraries.js?vadf2fdae:366
setTimeout (async)
jQuery.readyException @ libraries.js?vadf2fdae:366
(anonymous) @ libraries.js?vadf2fdae:366
mightThrow @ libraries.js?vadf2fdae:355
process @ libraries.js?vadf2fdae:357
setTimeout (async)
(anonymous) @ libraries.js?vadf2fdae:360
fire @ libraries.js?vadf2fdae:344
fireWith @ libraries.js?vadf2fdae:350
fire @ libraries.js?vadf2fdae:351
fire @ libraries.js?vadf2fdae:344
fireWith @ libraries.js?vadf2fdae:350
process @ libraries.js?vadf2fdae:359
setTimeout (async)
(anonymous) @ libraries.js?vadf2fdae:360
fire @ libraries.js?vadf2fdae:344
fireWith @ libraries.js?vadf2fdae:350
fire @ libraries.js?vadf2fdae:351
fire @ libraries.js?vadf2fdae:344
fireWith @ libraries.js?vadf2fdae:350
ready @ libraries.js?vadf2fdae:368
completed @ libraries.js?vadf2fdae:368
Steps I have tried to fix the problem: