SOLVED

MktoForms2.allForms() returning empty in local dev environment

Go to solution
Lukas_Meier
Level 2

MktoForms2.allForms() returning empty in local dev environment

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:

 

Lukas_Meier_0-1593724685567.png

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?

 

 

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Lukas_Meier
Level 2

Re: MktoForms2.allForms() returning empty in local dev environment

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

 

View solution in original post

7 REPLIES 7
SanfordWhiteman
Level 10 - Community Moderator

Re: MktoForms2.allForms() returning empty in local dev environment

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

Re: MktoForms2.allForms() returning empty in local dev environment

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 - Community Moderator

Re: MktoForms2.allForms() returning empty in local dev environment

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

Lukas_Meier
Level 2

Re: MktoForms2.allForms() returning empty in local dev environment

is there anything that works?

if I use a different virtual host, doesn't work either

 

If I directly access the URL of the script e.g.

http://app-lon09.marketo.com/index.php/form/getForm?munchkinId=...

 

then it works

it only doesnt't work, when i load the page to fill out the form

SanfordWhiteman
Level 10 - Community Moderator

Re: MktoForms2.allForms() returning empty in local dev environment

What browser + exact version are you using? CF tends to lag behind newer User-Agents as well.

Lukas_Meier
Level 2

Re: MktoForms2.allForms() returning empty in local dev environment

Where it doesnt work:

Chrome Version 83.0.4103.61 (Official Build) (64-bit)

 

Where it does work:

Opera Version:69.0.3686.49

 

 

both running on lubuntu 18.04

Lukas_Meier
Level 2

Re: MktoForms2.allForms() returning empty in local dev environment

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