-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from christoph-kluge/custom-origin
Feature: Add ability to enable strict host checking
- Loading branch information
Showing
7 changed files
with
110 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php | ||
|
||
use Psr\Http\Message\ServerRequestInterface; | ||
use React\EventLoop\Factory; | ||
use React\Http\Response; | ||
use React\Http\Server; | ||
use Sikei\React\Http\Middleware\CorsMiddleware; | ||
|
||
require __DIR__ . '/../vendor/autoload.php'; | ||
|
||
$loop = Factory::create(); | ||
|
||
$server = new Server([ | ||
new CorsMiddleware(['server_url' => 'http://api.example.net:8080']), | ||
function (ServerRequestInterface $request) { | ||
return new Response(200, ['Content-Type' => 'application/json'], json_encode([ | ||
'some' => 'nice', | ||
'json' => 'values', | ||
])); | ||
}, | ||
]); | ||
|
||
$socket = new \React\Socket\Server(isset($argv[1]) ? $argv[1] : '0.0.0.0:8080', $loop); | ||
$server->listen($socket); | ||
|
||
echo 'Listening on ' . str_replace('tcp:', 'http:', $socket->getAddress()) . PHP_EOL; | ||
|
||
$loop->run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters