Discussion:
How to split (A/B) test landing pages using httpd(8)
Clint Pachl
2021-04-16 00:58:30 UTC
Permalink
Does anyone know if it's possible to rotate/alternate between two
files for the same given request path, using just httpd?

For example, I want to split test two pages: /test/A & /test/B. I would
like to serve half of the traffic to each for the request path /test/.

Ideally, I would like to do an internal rewrite of the request. And be
able to log which file was actually served to the client.

Here's what I have so far, but I would like to avoid the redirect and
URL change on the client.

# httpd.conf: A/B test

location "/test/*[0-4]" {
request rewrite "/test/A"
}
location "/test/*[5-9]" {
request rewrite "/test/B"
}
location "/test/" {
block return 302 "$DOCUMENT_URI$REMOTE_PORT"
}


I'm using OpenBSD 6.8. I see there is a "not found" directive in 6.9.
Maybe something like that could provide possibilities?
Rafael Possamai
2021-04-20 15:07:58 UTC
Permalink
Post by Clint Pachl
Does anyone know if it's possible to rotate/alternate between two
files for the same given request path, using just httpd?
It might be a cleaner implementation if you use relayd(8) to load balance requests, there's also relayctl(8) which you could use to gather diagnostics, etc.

Personally, I have never attempted this with httpd alone.

Loading...