MktoForms2.allForms() returning empty in local dev environment | Community
Skip to main content
Lukas_Meier
Level 2
July 2, 2020
Solved

MktoForms2.allForms() returning empty in local dev environment

  • July 2, 2020
  • 1 reply
  • 4640 views

hello

we have, somewhat customized marketo forms that we use via the javascript api.

 

now the code stopped working in local dev environment, I suspect it is related to this call:

 

in written words: getForm?munchkinId=MYID&... returns 403 forbidden

 

basically I am getting a 403 and MktoForms2.whenReady never triggers

 

 

MktoForms2.allForms() returns []

 

this didn't use to be like that. This used to work.

 

Obviously, for local development, I use a virtual host e.g. mylocaldev.local

 

 

 

it still works in production, and it still works in staging as well where we use a subdomain of production

 

maybe I got black listed because I was "spamming" marketo with my local testing?

 

 

Best answer by Lukas_Meier

That seems reasonable. I don't like to use actual localhost anyway.


it seems to work fine if I use a different browser

for example I just ran a test with opera, seems to pass and load the script

 

Why opera, well, they have an integrated vpn. It works without vpn activated though as well..

 

worked on Opera Version:69.0.3686.49 on date 2020-07-8

 

1 reply

SanfordWhiteman
Level 10
July 2, 2020

It's not you, it's the... questionable (I'm being nice)... policies of CloudFlare when they flag traffic as not regular-end-user-ish.

 

In this case probably because of the Referer. Also happens when using a debugging proxy, which they seem to fingerprint using other means. It's absolutely frustrating but the policy is controlled centrally.

Lukas_Meier
Level 2
July 2, 2020

what would you recommend? create a virtual host of the prod domain for local dev? 

 

e.g. myproductivedomain.com as entry in my hosts file for dev environment?

SanfordWhiteman
Level 10
July 3, 2020

That seems reasonable. I don't like to use actual localhost anyway.