cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2302
Views
0
Helpful
3
Replies

Replace all URLs

tsilveruits
Level 1
Level 1

Without enabling URL filtering, would it be possible to rewrite all URLs received in emails on the external listener, say, if you wanted to just route them all to your own proxy? This wouldn't require enabling the URL filtering service on the ESA, which add processing overhead. I researched using message filters, but I would need to capture the URL and reuse it, and I see no way to do that. In content filters, and in message filters, I suppose, you could, as the ESA User Guide says, rewrite a URL like this, http://custom_proxy/$URL, to be, http://custom_proxy/http://example.com.

3 Replies 3

Robert Sherwin
Cisco Employee
Cisco Employee

This could be done w/ some trial and error to achieve what you are needing...  similar to strip URL --- you would need to use something similar to this logic:

Create the following message filter:

URL_Replaced:

if true {
edit-body-text("(?i)(?:https?|ftp)://[^\\s\">]+", "URL REMOVED");
}

The above filter will be applied to all messages, received or sent by the appliance. You can add a condition to filter only incoming mail.

URL_Replaced:

if recv-listener == "IncomingMail" {
edit-body-text("(?i)(?:https?|ftp)://[^\\s\">]+", "URL REMOVED");
}

The above filter will be applied to messages received by the listener named IncomingMail.

The string URL REMOVED will replace the url in the body of the message.
This will take any/all hyperlinks in the email, and change to “www.nhl.com”, or edit as needed:
change_url: if true {
edit-body-text("(?i)(?:http?|https?)://[^\\s\"]+", "http://www.nhl.com");
}
.
Take your pick how you would want to work in for your environment.
-Robert

Thanks, Robert. That is in the ESA User Guide, but I want to re-use the matched string (i.e., the URL). How would I do that? These examples demonstrate replacing a string with another string.

I do not see this as a configurable option available currently which would allow you to re-use the string.

The matched string can only be replaced with another string.

Regards

Libin