Skip to content

Instantly share code, notes, and snippets.

View tudorilisoi's full-sized avatar

Tudor Ilisoi tudorilisoi

View GitHub Profile
@tudorilisoi
tudorilisoi / cors.php
Created June 14, 2017 12:51
Cors headers with PHP
function cors() {
// Allow from any origin
if (isset($_SERVER['HTTP_ORIGIN'])) {
// Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
// you want to allow, and if so:
header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Max-Age: 86400'); // cache for 1 day
}
@tudorilisoi
tudorilisoi / proxy.js
Last active February 5, 2021 12:52
A https proxy server for external URLs
//a modified version of a gist ...which I forgot the URL of
var url = require('url')
, http = require('http')
, https = require('https');
var fs = require('fs');
var PORT = process.argv[2] || 443;