Forum Discussion
change http:/ links to https:/ except a certain URL
5 Replies
- nitass
Employee
can you try something like this?[root@ve1023:Active] config b virtual bar list virtual bar { snat automap pool foo destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} stream {} tcp {} } } [root@ve1023:Active] config b pool foo list pool foo { members 200.200.200.101:80 {} } [root@ve1023:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { STREAM::disable } when HTTP_RESPONSE { if {[HTTP::header value Content-Type] contains "text"}{ STREAM::expression {@http://www.no-change.com/@http://www.no-change.com/@@http://@https://@} STREAM::enable } } } [root@ve1023:Active] config curl http://200.200.200.101/test.html ...snipped... http://www.no-change.com/something http://www.change.com/something ...snipped... [root@ve1023:Active] config curl http://172.28.19.79/test.html ...snipped... http://www.no-change.com/something https://www.change.com/something ...snipped...
LTM stream profile: Multiple replacements & regular expressions by Deb
https://devcentral.f5.com/Tutorials/TechTips/tabid/63/articleType/ArticleView/articleId/101/LTM-stream-profile-Multiple-replacements-regular-expressions.aspx - hoolio
Cirrostratus
I like that idea of finding/replacing the same string to avoid the replacement Nitass. Here's another option using a lookaround regex:when HTTP_REQUEST { Disable the stream filter for all requests STREAM::disable } when HTTP_RESPONSE { Check if response type is text if {[HTTP::header value Content-Type] contains "text"}{ Replace any http:// instance with https://, unless the original string is http://www.no-change.com STREAM::expression {@http:(?!//www\.no-change\.com)@https://@} Enable the stream filter for this response only STREAM::enable } }
Aaron - kmtmt_51646
Nimbostratus
Hi nitass, hoolio
It worked perfectly!
Thank you, really appreciate it!
Best Regards,- aandreyy_293459
Nimbostratus
hi
i also want to do the same and exclude from changing to https but when i modify iRule with
if {[HTTP::header value Content-Type] starts_with "text"} {
STREAM::expression {@http:(?!//www\.w3\.org)@https://@}from STREAM::expression {@@}
page not loading at all, getting errors like "ERR_CONNECTION_RESET" "secure connections failed". Not sure what can cause this?
- aandreyy_293459
Nimbostratus
strange that after adding config STREAM::expression {@http:(?!//@} VIP not responding at all (did various configurations ). I can see than that browser not getting response at all while everything should work as before. Also i can see on iRule statistics numbers increasing. Can it be related with SW (11.6.1 build 2.0.338)? or something else?
Maybe someone can suggest use other regular expressions to do the same?
thanks
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