Ticket #645: nginx-proxy-patch-test.conf

File nginx-proxy-patch-test.conf, 2.2 KB (added by Alexey Radkov, 12 years ago)
Line 
1worker_processes 1;
2error_log /var/log/nginx/error.log info;
3
4events {
5 worker_connections 1024;
6}
7
8http {
9 server {
10 listen 80;
11 server_name proxy;
12
13 # bad conf
14 location / {
15 if ($arg_x = '') {
16 proxy_pass http://127.0.0.1:8010;
17 break;
18 }
19 proxy_pass http://$arg_x;
20 }
21 # ugly workaround
22 location /1 {
23 if ($arg_x = '') {
24 proxy_pass http://127.0.0.1:8010;
25 break;
26 }
27 if ($arg_x) {
28 proxy_pass http://$arg_x;
29 break;
30 }
31 return 500;
32 }
33 # rewrite workaround
34 location /2 {
35 if ($arg_x) {
36 rewrite ^ /3 last;
37 }
38 proxy_pass http://127.0.0.1:8010;
39 }
40 location /3 {
41 internal;
42 proxy_pass http://$arg_x;
43 }
44 # better rewrite workaround
45 location /4 {
46 if ($arg_x) {
47 rewrite ^(.*)$ /5$1$is_args$args last;
48 }
49 proxy_pass http://127.0.0.1:8010;
50 }
51 location ~* /5(.*) {
52 internal;
53 proxy_pass http://$arg_x$1;
54 }
55 # better original workaround
56 location /6 {
57 set $default_addr 127.0.0.1:8010;
58 if ($arg_x = '') {
59 proxy_pass http://$default_addr;
60 break;
61 }
62 proxy_pass http://$arg_x;
63 }
64 # test model permutations
65 location /7 {
66 if ($arg_x) {
67 proxy_pass http://$arg_x;
68 break;
69 }
70 proxy_pass http://127.0.0.1:8010;
71 }
72 location /8 {
73 if ($arg_x) {
74 proxy_pass http://127.0.0.1:8020;
75 break;
76 }
77 proxy_pass http://127.0.0.1:8010;
78 }
79 location /9 {
80 if ($arg_x) {
81 proxy_pass http://$arg_x;
82 break;
83 }
84 proxy_pass https://$arg_y;
85 }
86 }
87
88 server {
89 listen 8010;
90 server_name backend;
91
92 location / {
93 echo 'I am in backend';
94 }
95 }
96}
97