Commit 80728f19 authored by Geoff Simmons's avatar Geoff Simmons

Host header match for Ingress rules ignores port numbers.

Closes #9
parent 16a28709
......@@ -110,8 +110,8 @@ backend vk8s_tea-svc_192_0_2_3 {
sub vcl_init {
new vk8s_hosts = re2.set(posix_syntax=true, literal=true, anchor=both);
vk8s_hosts.add("cafe.example.com");
new vk8s_hosts = re2.set(anchor=both);
vk8s_hosts.add("\Qcafe.example.com\E(:\d+)?");
vk8s_hosts.compile();
new vk8s_coffee-svc_director = directors.random();
......
......@@ -33,8 +33,8 @@ backend vk8s_tea-svc_192_0_2_3 {
sub vcl_init {
new vk8s_hosts = re2.set(posix_syntax=true, literal=true, anchor=both);
vk8s_hosts.add("cafe.example.com");
new vk8s_hosts = re2.set(anchor=both);
vk8s_hosts.add("\Qcafe.example.com\E(:\d+)?");
vk8s_hosts.compile();
new vk8s_coffee-svc_director = directors.round_robin();
......
......@@ -33,8 +33,8 @@ backend vk8s_tea-svc_192_0_2_3 {
sub vcl_init {
new vk8s_hosts = re2.set(posix_syntax=true, literal=true, anchor=both);
vk8s_hosts.add("cafe.example.com");
new vk8s_hosts = re2.set(anchor=both);
vk8s_hosts.add("\Qcafe.example.com\E(:\d+)?");
vk8s_hosts.compile();
new vk8s_coffee-svc_director = directors.round_robin();
......
......@@ -33,8 +33,8 @@ backend vk8s_tea-svc_192_0_2_3 {
sub vcl_init {
new vk8s_hosts = re2.set(posix_syntax=true, literal=true, anchor=both);
vk8s_hosts.add("cafe.example.com");
new vk8s_hosts = re2.set(anchor=both);
vk8s_hosts.add("\Qcafe.example.com\E(:\d+)?");
vk8s_hosts.compile();
new vk8s_coffee-svc_director = directors.round_robin();
......
......@@ -80,9 +80,9 @@ backend {{backendName $svc $addr.IP}} {
sub vcl_init {
{{- if .Rules}}
new vk8s_hosts = re2.set(posix_syntax=true, literal=true, anchor=both);
new vk8s_hosts = re2.set(anchor=both);
{{- range $rule := .Rules}}
vk8s_hosts.add("{{$rule.Host}}");
vk8s_hosts.add("\Q{{$rule.Host}}\E(:\d+)?");
{{- end}}
vk8s_hosts.compile();
{{end}}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment