Forum Discussion
Wes_98712
Nimbostratus
Mar 14, 2007ReWrite HTTP Post
This is a very general question, searching through the forums I have seen some postings regarding rewriting HTTP posts, versus Gets. We have an interesting situation where we are rewriting URL requests and replacing a specific directory structure as follows:
Source URI Stem = /dbauth/plsql
Destination URI Stem = /dbauth/rptWhat should happen, and is, is that for specific packages (this is a legacy pl/sql app) we rewrite the URL and redirect it, now this works great for normal HTML requests, as soon as we start dealing with POSTS it seems things start to fall apart, specific variables that are supposed to be passed are not (still investigating this), but it stands to reason that the redirect is telling the client where to go, but would it also handle the POST as well since that is in the body of the HTML?
This is going to be a crapy forum question until I can get some real world examples. But till then, thought I'd open this up for discussion. Redirect GET versus POST.
-Wes
2 Replies
- Wes_98712
Nimbostratus
I don't think we have a multipart message issue, but not sure, here is the current iRule:when HTTP_REQUEST { set my_uri [HTTP::uri] set my_host [HTTP::host] set my_query [HTTP::query] if { [ matchclass $my_uri contains $::gms_splitout_reports_perf2_class] } { if { $my_uri starts_with "/dbauth/plsql" } { set my_new_path [string map {"dbauth/plsql" "dbauth/rpt"} $my_uri] log local0. "SWITCHING: http://$my_host$my_new_path" log local0. "URI Query: $my_query" HTTP::redirect "http://$my_host$my_new_path" } else { log local0. "URL: http://$my_host$my_uri" pool gms_app_qa_perf_temp_pool } } else { if { $my_uri starts_with "/dbauth/rpt" } { set my_new_path [string map {"dbauth/rpt" "dbauth/plsql"} $my_uri] HTTP::redirect "http://$my_host$my_new_path" } else { pool gms_app_qa_perf_temp_pool } } }
I'm wondering if I can replace the HTTP::redirect part with something else that simply replaces the strings I am looking for. Not sure if setting the location is better or what, I am trying to search through the forums, and as usual the search engine here is flakey with the new devcentral release.
Thoughts? - Wes_98712
Nimbostratus
Perhaps something like this?when HTTP_REQUEST { set my_uri [HTTP::uri] set my_host [HTTP::host] set my_query [HTTP::query] if { [ matchclass $my_uri contains $::gms_splitout_reports_perf2_class] } { if { $my_uri starts_with "/dbauth/plsql" } { set my_new_path [string map {"dbauth/plsql" "dbauth/rpt"} $my_uri] log local0. "SWITCHING: http://$my_host$my_new_path" log local0. "URI Query: $my_query" HTTP::uri $my_new_path } else { log local0. "URL: http://$my_host$my_uri" pool gms_app_qa_perf_temp_pool } } else { if { $my_uri starts_with "/dbauth/rpt" } { set my_new_path [string map {"dbauth/rpt" "dbauth/plsql"} $my_uri] HTTP::uri $my_new_path } else { pool gms_app_qa_perf_temp_pool } } }
I believe this will reset the URI to what I want it to be before I send it back to the pool for servicing, correct me if I am wrong here.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects