Forum Discussion
Sharepoint and Javascript Cancel event
I have a public site where users log into (F5 APM) and get to an internal Sharepoint page. The external site is called example.company.com and internall the Sharepoint site is called example_isa.company.com (it used to be behind an ISA server). I have a stream irule event so the user only ever sees example.company.com Everything works great but one thing.
When a user goes to the "upload a document" page and clicks on Cancel, it errors out. the cancel code shows this -
example_isa.company.com
I have the following code
when HTTP_RESPONSE {
STREAM::disable
if { [HTTP::header is_redirect] } {
HTTP::header replace Location [string map {"http://example_isa.company.com" "https://example.company.com"} [HTTP::header value Location]] }
if {[HTTP::header value Content-Type] contains "text"}{
STREAM::expression {@http://example.company.com@https://example.company.com@ @http://example.company.com@https://example.company.com@ @http:\u002f\u002f@https:\u002f\u002f@ @http:\\u002f\\u002f@https:\\u002f\\u002f@ }
STREAM::enable }}
when STREAM_MATCHED {
log local0. "matched: [STREAM::match]"}
With this, i get a 404 error and the URL looks like this -
Any Ideas??
14 Replies
- Chris_Miller
Altostratus
So basically, the goal is to rewrite this:
http:\u002f\u002fexample_isa.company.com\u002fInformationTechnology\u002fFo...Items.aspx
to this:
https://example.company.com/... - George_Watkins_Historic F5 Account
The problem is that those unicode characters are not being interpreted due to the '{ }' around the stream expression. Can you give this a shot?
when HTTP_RESPONSE {
STREAM::disable
set encoding_header [HTTP::header value Encoding]
if { $encoding_header contains "text)" } {
if { $encoding_header contains "charset=utf-8" } {
set slash "\u002f"
} else {
set slash "/"
}
set expression "@http:$slash$slash@https:$slash$slash@"
STREAM::expression $expression
STREAM::enable
}
}
when STREAM_MATCHED {
log local0. "matched: [STREAM::match]"
}
Regards,
George - AngryCat_52750
Nimbostratus
George,
Can i have two stream profiles coz i still need to stream the other stuff.. - Chris_Miller
Altostratus
Something like this perhaps?
when HTTP_RESPONSE {
set host "www.example.com"
STREAM::disable
if { [HTTP::header is_redirect] } {
HTTP::header replace Location [string map {"http://example_isa.company.com" "https://example.company.com"} [HTTP::header value Location]] }
if {[HTTP::header value Content-Type] contains "text"}{
if { $encoding_header contains "charset=utf-8" } {
set slash "\u002f"
} else {
set slash "/"
}
STREAM::expression {@http://example.company.com@https://example.company.com@ @http://example.company.com@https://example.company.com@ "@http:$slash$slash@https:$slash$slash$host@" }
STREAM::enable }}
when STREAM_MATCHED {
log local0. "matched: [STREAM::match]"} - George_Watkins_Historic F5 Account
Sure, you just need to append that expression variable. Make sure you add a space after every entry or the expression syntax will be off. If you find more unicode characters that aren't matching, you'll need to map those as well. Here's an example with a few other expressions:
when HTTP_RESPONSE {
STREAM::disable
set encoding_header [HTTP::header value Encoding]
if { $encoding_header contains "text)" } {
if { $encoding_header contains "charset=utf-8" } {
set slash "\u002f"
} else {
set slash "/"
}
set expression "@http:$slash$slash@https:$slash$slash@ "
append expression "@abc.example.com@new.example.com@ "
append expression "@Some other text@Some new text@ "
append expression "@some curse word@polite version@"
STREAM::expression $expression
STREAM::enable
}
}
when STREAM_MATCHED {
log local0. "matching with expression set: $expression"
log local0. "matched: [STREAM::match]"
}
Make sense? Did the other example correctly replace those links in your Sharepoint page?
-George - Chris_Miller
Altostratus
Sorry, $host should probably be set to example.company.com - AngryCat_52750
Nimbostratus
i am cleaning up the code now.. give me a minute.. i like the append option.. - George_Watkins_Historic F5 Accountkulastone,
Make sure you remove those log statements before you put this into production. If the local0 facility is pointing at the local disk you're going to kill your performance by blocking on I/O to log. If you need to log iRules in production, make sure you use the HSL (high speed logging) command to send the logs off box. HSL is UDP syslog and "best effort" therefore it won't block the request from traversing the BIG-IP.
-George - AngryCat_52750
Nimbostratus
Nothing in the logs from after the update..
- AngryCat_52750
Nimbostratus
Thanks for the heads up on the logging.. this box is kinda dead right now.. only 4 VSs..
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
