Skip to content

Commit

Permalink
improvement for dev server
Browse files Browse the repository at this point in the history
  • Loading branch information
haarg committed Jun 25, 2018
1 parent 0202447 commit 74faea3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
19 changes: 19 additions & 0 deletions run-dev
@@ -1,5 +1,24 @@
#!/bin/bash

while [[ $# -gt 0 ]]; do
case "$1" in
--suffix)
METACPAN_WEB_CONFIG_LOCAL_SUFFIX="$2"
export METACPAN_WEB_CONFIG_LOCAL_SUFFIX
shift
;;
--suffix=*)
METACPAN_WEB_CONFIG_LOCAL_SUFFIX="${1:9}"
export METACPAN_WEB_CONFIG_LOCAL_SUFFIX
;;
*)
echo "Unsupported option $1" >&2
exit 1
;;
esac
shift
done

export METACPAN_WEB_PORT=5001
export PLACK_ENV=development
export COLUMNS="$(tput cols)"
Expand Down
14 changes: 13 additions & 1 deletion static-app.psgi
Expand Up @@ -10,5 +10,17 @@ my $port = $ENV{METACPAN_WEB_PORT} || 5001;

builder {
enable '+MetaCPAN::Middleware::Static' => root => $root_dir;
mount '/' => Plack::App::Proxy->new(remote => "http://localhost:$port")->to_app;
enable sub {
my ($app) = @_;
sub {
my ($env) = @_;
$env->{HTTP_X_FORWARDED_HTTPS} = 'ON'
if $env->{'psgi.url_scheme'} eq 'https';
$app->($env);
};
};
mount '/' => Plack::App::Proxy->new(
remote => "http://localhost:$port",
preserve_host_header => 1,
)->to_app;
};

0 comments on commit 74faea3

Please sign in to comment.