varnish: Correctly handle the vhost when the port number is included
If a vhost is received with :, it was not handled by the regexps managing the backend selection and forwarded to the default backend.
Related to T2877
Test Plan
octocatalog-diff
- moma:
diff origin/production/moma.softwareheritage.org current/moma.softwareheritage.org
*******************************************
File[/etc/varnish/includes/50_vhost_archive.softwareheritage.org.vcl] =>
parameters =>
content =>
@@ -7,8 +7,8 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)base\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)webapp0\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)base\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp0\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -24,8 +24,8 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)base\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)webapp0\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)base\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp0\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
File[/etc/varnish/includes/50_vhost_deposit.softwareheritage.org.vcl] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)deposit\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)deposit\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Profile::Varnish::Vcl_include[vhost_archive.softwareheritage.org] =>
parameters =>
content =>
@@ -7,8 +7,8 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)base\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)webapp0\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)base\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp0\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -24,8 +24,8 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)base\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)webapp0\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)base\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp0\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Profile::Varnish::Vcl_include[vhost_deposit.softwareheritage.org] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)deposit\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)deposit\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Varnish::Vcl[/etc/varnish/includes/50_vhost_archive.softwareheritage.org.vcl] =>
parameters =>
content =>
@@ -7,8 +7,8 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)base\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)webapp0\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)base\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp0\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -24,8 +24,8 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)base\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)webapp0\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)archive\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)base\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp0\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)archive\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Varnish::Vcl[/etc/varnish/includes/50_vhost_deposit.softwareheritage.org.vcl] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)deposit\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org$" ||
- req.http.host ~ "^(?i)deposit\.softwareheritage\.org$"
+ req.http.host ~ "^(?i)deposit\.internal\.softwareheritage\.org(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.softwareheritage\.org(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
*** End octocatalog-diff on moma.softwareheritage.org
- rp0.staging:
diff origin/production/rp0.internal.staging.swh.network current/rp0.internal.staging.swh.network
*******************************************
File[/etc/varnish/includes/50_vhost_deposit.staging.swh.network.vcl] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)deposit\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)deposit\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
File[/etc/varnish/includes/50_vhost_webapp.staging.swh.network.vcl] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)webapp\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)webapp\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Profile::Varnish::Vcl_include[vhost_deposit.staging.swh.network] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)deposit\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)deposit\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Profile::Varnish::Vcl_include[vhost_webapp.staging.swh.network] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)webapp\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)webapp\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Varnish::Vcl[/etc/varnish/includes/50_vhost_deposit.staging.swh.network.vcl] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)deposit\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)deposit\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)deposit\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)deposit\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
Varnish::Vcl[/etc/varnish/includes/50_vhost_webapp.staging.swh.network.vcl] =>
parameters =>
content =>
@@ -7,6 +7,6 @@
sub vcl_recv {
if (
- req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)webapp\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) == 80) {
@@ -22,6 +22,6 @@
sub vcl_deliver {
if (
- req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network$" ||
- req.http.host ~ "^(?i)webapp\.staging\.swh\.network$"
+ req.http.host ~ "^(?i)webapp\-rp\.internal\.staging\.swh\.network(:[0-9]+)?$" ||
+ req.http.host ~ "^(?i)webapp\.staging\.swh\.network(:[0-9]+)?$"
) {
if (std.port(server.ip) != 80) {
*******************************************
*** End octocatalog-diff on rp0.internal.staging.swh.network
Migrated from D4719 (view on Phabricator)