Skip to content

Instantly share code, notes, and snippets.

@derralf
Last active January 26, 2022 16:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save derralf/1b0401b403175269252c361c7fca4e21 to your computer and use it in GitHub Desktop.
Save derralf/1b0401b403175269252c361c7fca4e21 to your computer and use it in GitHub Desktop.
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