Skip to content

Instantly share code, notes, and snippets.

diff --git a/kong/core/handler.lua b/kong/core/handler.lua
index 80bec19..1927adf 100644
--- a/kong/core/handler.lua
+++ b/kong/core/handler.lua
@@ -138,6 +138,8 @@ return {
var.upstream_host = host_header or
balancer_address.hostname..":"..balancer_address.port
+ var.has_query = var.request_uri:find("?", nil, true) and
+ var.is_args == "?" and "?" or ""
Frame 1: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Interface id: 0 (any)
Encapsulation type: Linux cooked-mode capture (25)
Arrival Time: Jun 8, 2017 23:15:21.700806000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1496963721.700806000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
vagrant@vagrant-ubuntu-trusty-64:/kong$ bin/busted spec/04-invalidations/ -o=TAP
ok 1 - cluster_events with db: postgres #o new() creates an instance
ok 2 - cluster_events with db: postgres #o new() instanciates only once (singleton)
ok 3 - cluster_events with db: postgres #o new() generates an identical node_id for all instances on a node
ok 4 - cluster_events with db: postgres #o new() instanciates but does not start polling
not ok 5 - cluster_events with db: postgres pub/sub broadcasts on a given channel
# spec/04-invalidations/01-cluster_events_spec.lua @ 80
# Failure message: spec/04-invalidations/01-cluster_events_spec.lua:83: opts.dao is required
ok 6 - cluster_events with db: postgres pub/sub broadcasts data to subscribers
ok 7 - cluster_events with db: postgres pub/sub does not broadcast events on the same node
$ luajit ./t.lua > /dev/null
---- TRACE 1 start t.lua:10
0014 GGET 7 5 ; "math"
0015 TGETS 7 7 6 ; "random"
0016 KSHORT 8 1
0017 KSHORT 9 10
0018 CALL 7 2 3
0000 . FUNCC ; math.random
0019 ISGE 0 7
0020 JMP 7 => 0024
$ luajit ./t.lua > /dev/null
---- TRACE 1 start t.lua:12
0014 MOV 7 1
0015 KSTR 8 5 ; "foo"
0016 GGET 9 6 ; "math"
0017 TGETS 9 9 7 ; "random"
0018 KSHORT 10 1
0019 KSHORT 11 10
0020 CALL 9 0 3
0000 . FUNCC ; math.random
keepalive related error logs. note the 60 second timeout to close the connection pools
root@vagrant-ubuntu-trusty-64:/usr/local/openresty/nginx# grep 4517 ./logs/error.log | grep keepalive
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket pool get keepalive peer
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket keepalive connection pool not found
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket set keepalive: saving connection 00007F919692B438
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket keepalive create connection pool for key "127.0.0.1:82"
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket keepalive timeout: 60000 ms
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket pool get keepalive peer
2017/05/19 21:13:45 [debug] 4517#0: *1 lua tcp socket get keepalive peer: using connection 00007F919692B438, fd:13
Frame 1: 76 bytes on wire (608 bits), 76 bytes captured (608 bits) on interface 0
Interface id: 0
Encapsulation type: Linux cooked-mode capture (25)
Arrival Time: May 19, 2017 21:21:17.867668000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1495228877.867668000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1
2017/05/19 21:13:40 [debug] 4517#0: malloc: 00007F91968EFBD0:6144
2017/05/19 21:13:40 [debug] 4517#0: malloc: 00007F919692AFB0:237568
2017/05/19 21:13:40 [debug] 4517#0: malloc: 00007F9196964FC0:98304
2017/05/19 21:13:40 [debug] 4517#0: malloc: 00007F919697CFD0:98304
2017/05/19 21:13:40 [debug] 4517#0: epoll add event: fd:8 op:1 ev:00002001
2017/05/19 21:13:40 [debug] 4517#0: epoll add event: fd:9 op:1 ev:00002001
2017/05/19 21:13:40 [debug] 4517#0: epoll add event: fd:10 op:1 ev:00002001
2017/05/19 21:13:40 [debug] 4517#0: setproctitle: "nginx: worker process"
2017/05/19 21:13:40 [debug] 4517#0: worker cycle
2017/05/19 21:13:40 [debug] 4517#0: epoll timer: -1
From 2b2617a0e472e31a0d8da618e5a64b731a05859c Mon Sep 17 00:00:00 2001
From: Robert Paprocki <robert@cryptobells.com>
Date: Tue, 2 May 2017 16:22:04 -0700
Subject: [PATCH] feat(cors) match configured origins as a regular expression
Use the ngx.re API to match configured origins as regular expressions
against the client Origin header. In cases where a single origin is
configured for the plugin, set the ACAO header if the configuration
contains only non-PCRE metacharacters; otherwise, treat the single
configured origin as a though multiple origins were configured, by
Frame 1: 113 bytes on wire (904 bits), 113 bytes captured (904 bits) on interface 0
Interface id: 0
Encapsulation type: Ethernet (1)
Arrival Time: May 9, 2017 15:47:35.602487000 UTC
[Time shift for this packet: 0.000000000 seconds]
Epoch Time: 1494344855.602487000 seconds
[Time delta from previous captured frame: 0.000000000 seconds]
[Time delta from previous displayed frame: 0.000000000 seconds]
[Time since reference or first frame: 0.000000000 seconds]
Frame Number: 1