Skip to content

Commit 61d3a12

Browse files
chadiiichadiii
chadiii
authored and
chadiii
committed
commit example in pres
1 parent 11fc1a4 commit 61d3a12

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

config/nginx-conf

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
# Default server configuration
2020
#
2121

22+
proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m;
23+
24+
upstream originserver {
25+
server 127.0.0.1:8081;
26+
}
27+
28+
map $http_user_agent $browser_type {
29+
default "Edge";
30+
"~Mozilla.*Firefox*" "Firefox";
31+
"~Chrome*" "Chrome";
32+
}
33+
2234
server {
2335
#set $browser 'c0n48jn5thv01k0ijmo0';
2436
listen 80 default_server;
@@ -48,28 +60,45 @@ server {
4860
server_name _;
4961
error_log /var/log/nginx/error.log debug;
5062

51-
fs_init 'blvo2kijq6pg023l8edg' 'wwURPfcEB01YVMfTYWfCtaezCkXVLeFZ61FJmXtI' '60' 'DEBUG' '0';
63+
fs_init 'c0n48jn5thv01k0ijmo0' 'BsIK86oh7c12c9G7ce4Wm1yBlWeaMf3t1S0xyYzI' '500' 'ERROR' '0';
5264

5365
location /test {
5466
fs_visitor_id $request_id;
55-
fs_visitor_context user_agent:$http_user_agent;
67+
fs_visitor_context browser:$browser_type;
5668
fs_get_all_flags;
5769

70+
include proxy_params;
71+
proxy_buffering on;
72+
proxy_cache my_cache;
73+
proxy_cache_valid any 10m;
74+
75+
add_header X-Proxy-Cache $upstream_cache_status;
5876
add_header x-flags $fs_flags;
77+
add_header x-browser_type $browser_type;
78+
79+
proxy_set_header X-Flagship-Flags $fs_flags;
80+
proxy_cache_key $fs_flags;
81+
5982
default_type text/html;
60-
return 200 'gangnam style2!';
83+
84+
proxy_pass http://originserver;
85+
86+
#return 200 $fs_flags;
6187
}
6288

63-
location /loca {
64-
set $visitor "visitor_id";
65-
66-
fs_visitor_id $visitor;
67-
fs_visitor_context 'browser:Chrome';
68-
# fs_get_all_flags;
69-
70-
add_header x-flags "youpi";
89+
location /experiment {
90+
91+
include proxy_params;
92+
proxy_buffering on;
93+
proxy_cache my_cache;
94+
proxy_cache_valid any 10m;
95+
96+
proxy_set_header X-Flagship-Flags "noflag";
97+
7198
default_type text/html;
72-
return 200 'gangnam style 2!';
99+
100+
proxy_pass http://originserver;
101+
73102
}
74103

75104
# pass PHP scripts to FastCGI server

0 commit comments

Comments
 (0)