Forum Discussion
Need help in creating iRule
Hi All,
I need a iRUle which does the same work as following nginix rule
Nginix Rule
worker_processes 1; events { worker_connections 1024; }
http { include mime.types; default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
upstream xbase { server 192.168.10.101:18080; server 192.168.10.103:18080; }
upstream xiservice { server 192.168.10.101:8090; server 192.168.10.103:8090; }
upstream xirest { server 192.168.10.101:18080; server 192.168.10.103:18080; } server { listen 8888; server_name localhost;
location /xinsights/services/xbase/ { proxy_pass_header Set-Cookie; proxy_pass_header P3P; proxy_pass http://xbase/xinsightsrest/xbase/; } location /xinsights/xinsightsrest/ { proxy_pass_header Set-Cookie; proxy_pass_header P3P; proxy_pass http://xirest/xinsightsrest/; } location /xinsights/services/api/ { proxy_pass_header Set-Cookie; proxy_pass_header P3P; proxy_pass http://xiservice/api/; } location /xinsights/ui/ { proxy_pass_header Set-Cookie; proxy_pass_header P3P; proxy_pass http://xiservice/; } location / { root html; index index.html index.htm index.json; add_header Content-Type application/json; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; }
}
1 Reply
- IheartF5_45022
Nacreous
Hi Ravi,
Here's a hint - just guessing a few bits and left out a few, but should get you started;-
pl_xbase_18080 members 192.168.10.101:18080 192.168.10.103:18080 pl_xiservice members 192.168.10.101:8090 192.168.10.103:8090 pl_xirest members 192.168.10.101:18080 192.168.10.103:18080then;-
when HTTP_REQUEST { set fRoot 0 switch [HTTP:: path] { "/xinsights/services/xbase/" { pool pl_xbase_18080 HTTP::uri "/xinsightsrest/xbase/" } "xinsights/xinsightsrest/ { pool pl_xirest_18080 HTTP::uri "/xinsightsrest/" } "/xinsights/services/api/ { pool pl_xiservice_8090 HTTP::uri "/api/" } "/xinsights/ui/" { pool pl_xiservice_8090 HTTP::uri "/" } "/" { set fRoot 1 } } when LB_FAILED { HTTP::respond 502 content [class match -value "502" dg_5xx_pages] noserver Retry-After 300 } when HTTP_RESPONSE { if {$fRoot} { HTTP::header insert Content-Type "application/json" } }You can also use a Local Traffic Policy to perform many of the iRule statements above.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com