projects
/
remoteglot
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Inform the engine if we have a Chess960 game.
[remoteglot]
/
default.vcl
diff --git
a/default.vcl
b/default.vcl
index
ef0b7d7
..
bb52d64
100644
(file)
--- a/
default.vcl
+++ b/
default.vcl
@@
-2,6
+2,7
@@
vcl 4.0;
vcl 4.0;
+# You can have multiple ones; see vcl_recv.
backend analysis {
.host = "127.0.0.1";
.port = "5000";
backend analysis {
.host = "127.0.0.1";
.port = "5000";
@@
-18,15
+19,24
@@
sub vcl_recv {
}
if (req.http.host ~ "analysis\.sesse\.net$" && req.url ~ "^/analysis\.pl") {
set req.backend_hint = analysis;
}
if (req.http.host ~ "analysis\.sesse\.net$" && req.url ~ "^/analysis\.pl") {
set req.backend_hint = analysis;
+ # Ignored by the backend; just to identify it in vcl_backend_response.
+ set req.http.x-analysis-backend = "backend1";
return (hash);
}
return (hash);
}
+ # You can check on e.g. /analysis2\.pl here if you have multiple
+ # backends; just remember to set x-analysis-backend to something unique.
}
sub vcl_deliver {
if (resp.http.x-analysis) {
}
sub vcl_deliver {
if (resp.http.x-analysis) {
- set resp.http.date = now;
+ set resp.http.Date = now;
+ unset resp.http.X-Varnish;
+ unset resp.http.Via;
+ unset resp.http.Age;
+ unset resp.http.X-Powered-By;
}
unset resp.http.x-analysis;
}
unset resp.http.x-analysis;
+ unset resp.http.x-analysis-backend;
}
sub vcl_hash {
}
sub vcl_hash {
@@
-45,9
+55,18
@@
sub vcl_backend_response {
if (beresp.http.content-type ~ "text" || beresp.http.content-type ~ "json") {
set beresp.do_gzip = true;
}
if (beresp.http.content-type ~ "text" || beresp.http.content-type ~ "json") {
set beresp.do_gzip = true;
}
+ if (bereq.url ~ "^/hash/") {
+ set beresp.ttl = 5s;
+ set beresp.http.x-analysis = 1;
+ set beresp.http.x-analysis-backend = bereq.http.x-analysis-backend;
+ return (deliver);
+ }
if (beresp.http.content-type ~ "json") {
set beresp.http.x-analysis = 1;
if (beresp.http.content-type ~ "json") {
set beresp.http.x-analysis = 1;
- ban ( "obj.http.x-analysis == 1 && obj.http.x-remoteglot-last-modified != " + beresp.http.x-remoteglot-last-modified );
+ set beresp.http.x-analysis-backend = bereq.http.x-analysis-backend;
+ ban ( "obj.http.x-analysis == 1 && " +
+ "obj.http.x-analysis-backend == " + bereq.http.x-analysis-backend + " && " +
+ "obj.http.x-rglm != " + beresp.http.x-rglm );
}
return (deliver);
}
}
return (deliver);
}