Skip to content

Commit

Permalink
server onRequest handler no longer requires a socket in the request (#…
Browse files Browse the repository at this point in the history
…9438)

Backports PR #9332

**Commit 1:**
server onRequest handler no longer requires a socket in the request

Per #9302 A request sent through a HapiJS .inject() doesn't have
a socket associated with the request, which causes a failure.

* Original sha: a5452f7
* Authored by Megan Walker <megan.walker@uk.ibm.com> on 2016-12-01T15:29:12Z
  • Loading branch information
elastic-jasper authored and cjcenizal committed Dec 10, 2016
1 parent 33d23d0 commit aa828cd
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/server/http/setup_connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ export default function (kbnServer, server, config) {
});

server.ext('onRequest', function (req, reply) {
if (req.raw.req.socket.encrypted) {
// A request sent through a HapiJS .inject() doesn't have a socket associated with the request
// which causes a failure.
if (!req.raw.req.socket || req.raw.req.socket.encrypted) {
reply.continue();
} else {
reply.redirect(formatUrl({
Expand Down

0 comments on commit aa828cd

Please sign in to comment.