USE CASES FOR CLOUD PAGES
CLOUD PAGES HOSTED IN MARKETING CLOUD ARE PUBLICALLY ACCESSIBLE, WE DONT WANT EXTERNAL AGENCIES TO ACCESS OUR CLOUD PAGES.
WRITE THIS CODE INTO YOUR HTML CONTENT BLOCK :
<script runat='server'>
Platform.Load('core', '1.1.1');
function ValidateAccess(){
try {
var referer = Platform.Request.ReferrerURL;
var regex =/^(https:\/\/(.*\.)?((mc.s50.exacttarget)\.com))($|\/)/g;
var match = referer.match(regex);
var origin = (match.length > 0) ? match[1] : null;
if (origin != null) {
return true;
} else {
return false;
}
} catch(error) {
return true;
}
}
</script>
CALL THIS CONTENT BLOCK IN YOUR CLOUD PAGE AT THE VERY BEGINNING. CALL THE FUNCTION
ValidateAccess(), IF IT RETURNS TRUE CONTINUE WITH THE CLOUD PAGE USE CASE ELSE
REDDIRECT THE USER TO ERROR PAGE.
Comments
Post a Comment