This file contains hidden or 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
sub jwt { | |
if(req.http.cookie ~ "^([^;]+;[ ]*)*token=[^\.]+\.[^\.]+\.[^\.]+([ ]*;[^;]+)*$") { | |
set req.http.x-token = ";" + req.http.Cookie; | |
set req.http.x-token = regsuball(req.http.x-token, "; +", ";"); | |
set req.http.x-token = regsuball(req.http.x-token, ";(token)=","; \1="); | |
set req.http.x-token = regsuball(req.http.x-token, ";[^ ][^;]*", ""); | |
set req.http.x-token = regsuball(req.http.x-token, "^[; ]+|[; ]+$", ""); | |
set req.http.tmpHeader = regsub(req.http.x-token,"token=([^\.]+)\.[^\.]+\.[^\.]+","\1"); | |
set req.http.tmpTyp = regsub(digest.base64url_decode(req.http.tmpHeader),{"^.*?"typ"\s*:\s*"(\w+)".*?$"},"\1"); |
This file contains hidden or 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
sub vcl_recv { | |
if (req.http.host == "blog.feryn.eu") { | |
return(vcl(blog_vcl)); | |
} | |
if (req.http.host == "talks.feryn.eu") { | |
return(vcl(talks_vcl)); | |
} | |
} |
This file contains hidden or 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
vcl.load blog /etc/varnish/blog.vcl | |
vcl.load talks /etc/varnish/talks.vcl | |
vcl.label blog_vcl blog | |
vcl.label talks_vcl talks |
This file contains hidden or 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
backend default { | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
.proxy_header = 1; | |
} |
This file contains hidden or 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
<?php | |
function double(int $argument):string { | |
return [$argument*2]; | |
} | |
var_dump(double(3)); |
This file contains hidden or 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
<?php | |
function double(int $argument):int { | |
return $argument*2; | |
} | |
var_dump(double([])); |
This file contains hidden or 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
<?php | |
function double(int $argument):string { | |
return $argument*2; | |
} | |
var_dump(double(3)); |
This file contains hidden or 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
<?php | |
function double(int $argument):int { | |
return $argument*2; | |
} | |
var_dump(double("2")); |
This file contains hidden or 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
<?php | |
function double(int $argument):int { | |
return $argument*2; | |
} | |
try { | |
var_dump(double([3])); | |
} catch (TypeError $e) { | |
echo "Caught as type error: ".$e->getMessage().PHP_EOL; | |
} |
This file contains hidden or 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
<?php | |
declare(strict_types=1); | |
function double(int $argument):int { | |
return $argument*2; | |
} | |
try { | |
var_dump(double("3")); | |
} catch (TypeError $e) { |