diff options
author | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-02-08 18:10:13 +0000 |
---|---|---|
committer | Matthew Somerville <matthew-github@dracos.co.uk> | 2019-02-11 17:02:25 +0000 |
commit | 1825a09bbdfee97928a251a84534d859b1a43387 (patch) | |
tree | 62bfe6f37a2a7c958f86e3641aacae75399a01c0 | |
parent | fb65300cbf6fb9ca9ad077b12d44f188294d8005 (diff) |
Better working of /fakemapit/ under https.
If no MAPIT_URL is provided, MapIt lookups default to /fakemapit/ at the
same host. But that host might already be set up for HTTPS, so port
might be 443.
-rw-r--r-- | CHANGELOG.md | 1 | ||||
-rw-r--r-- | perllib/FixMyStreet/App.pm | 6 |
2 files changed, 4 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 8f43c9558..da8db9838 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - Fix issue with Open311 codes starting with ‘_’. - Development improvements: - Make front page cache time configurable. + - Better working of /fakemapit/ under https. * v2.5 (21st December 2018) - Front end improvements: diff --git a/perllib/FixMyStreet/App.pm b/perllib/FixMyStreet/App.pm index 21f9082bb..2a279c4e2 100644 --- a/perllib/FixMyStreet/App.pm +++ b/perllib/FixMyStreet/App.pm @@ -237,9 +237,9 @@ sub setup_request { $c->stash->{map_js} = FixMyStreet::Map::map_javascript(); unless ( FixMyStreet->config('MAPIT_URL') ) { - my $port = $c->req->uri->port; - $host = "$host:$port" unless $port == 80; - mySociety::MaPit::configure( "http://$host/fakemapit/" ); + my $host_port = $c->req->uri->host_port; + my $scheme = $c->req->uri->scheme; + mySociety::MaPit::configure( "$scheme://$host_port/fakemapit/" ); } $c->stash->{has_fixed_state} = FixMyStreet::DB::Result::Problem::fixed_states->{fixed}; |