<?php

// require_once '../v1/vendor/autoload.php';
require_once '../vendor/autoload.php';

enableDebug();

if (isset($_SERVER['HTTP_ORIGIN'])) {
    $origin = $_SERVER['HTTP_ORIGIN'];
} else if (isset($_SERVER['HTTP_REFERER'])) {
    $origin = $_SERVER['HTTP_REFERER'];
} else {
    $origin = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";;
}
header("Access-Control-Allow-Origin: {$origin}");
