Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Allow multiple Origins für phpList
/*
=========================================================================
Hack: Allow multiple Origins
z.B. für Ajax-Anmeldung von Subdomain
platziere dies zu oberst in /lists/config/config.php
=========================================================================
*/
$custom_allowed_origins = [
"http://mydomain.net",
"https:/mydomain.net",
"http://www.mydomain.net",
"https://www.mydomain.net",
"http://dev.mydomain.net",
"https://dev.mydomain.net",
"http://newsletter.mydomain.net",
"https:/newsletter.mydomain.net",
"http://newsletter-dev.mydomain.net",
"https:/newsletter-dev.mydomain.net"
];
if (in_array($_SERVER["HTTP_ORIGIN"], $custom_allowed_origins)) {
// wenn wir hier die Konstante nicht definieren, wird dort ein Standard festgelegt: lists/admin/init.php
define("ACCESS_CONTROL_ALLOW_ORIGIN", $_SERVER["HTTP_ORIGIN"]);
// würde nicht phpList selbst den Header setzen (in lists/index.php) würde man etvl. etwas in der Art ausgeben
// header("Access-Control-Allow-Origin: " . $_SERVER["HTTP_ORIGIN"]);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment