Created
May 15, 2014 15:22
-
-
Save memememomo/e8ab6fa8e422b8ad31a2 to your computer and use it in GitHub Desktop.
開発用にplackupで自己認証サーバを立ち上げる ref: http://qiita.com/uchiko/items/24670c605cdc1fc2e7e7
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
use Plack::Builder; | |
builder { | |
enable sub { | |
my $app = shift; | |
sub { | |
my $env = shift; | |
$env->{"HTTP_X_Forwarded_HTTPS"} = 1; | |
my $res = $app->($env); | |
return $res; | |
}; | |
}; | |
$app; | |
}; |
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
$ openssl genrsa 2048 > server.key |
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
$ openssl req -new -key server.key -out server.csr -subj '/C=JP/ST=Tokyo/L=Tokyo/O=Example Ltd./OU=Web/CN=example.com' |
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
$ openssl x509 -in server.csr -days 365 -req -signkey server.key > server.crt |
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
$ plackup -s HTTP::Server::PSGI --ssl-key-file server.key --ssl-cert-file server.crt --ssl 1 app.psgi | |
HTTP::Server::PSGI: Accepting connections at https://0:5000/ |
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
$ plackup -e "`cat httpxforwardedhttps.pl`" -s HTTP::Server::PSGI --ssl-key-file server.key --ssl-cert-file server.crt --ssl 1 app.psgi | |
HTTP::Server::PSGI: Accepting connections at https://0:5000/ |
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
enable sub { | |
my $app = shift; | |
sub { | |
my $env = shift; | |
$env->{"HTTP_X_Forwarded_HTTPS"} = 1; | |
my $res = $app->($env); | |
return $res; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment