Forum Discussion
Jim_Jack_103645
Nimbostratus
Feb 19, 2007remove trailing periods
We are receiving a number of users trying to access our webpages but they put a trailing period in the URL e.g.:
'http://www.thesite.com./Default.aspx'
Note the '.com.'
How can I remove...
hoolio
Cirrostratus
Feb 19, 2007It seems a bit strange that users would add a trailing period, but...
To remove a trailing period if there is one, you can use 'string trimright', like this:
when HTTP_REQUEST {
if { [HTTP_HOST ends_with "." }{
HTTP::host [string trimright [HTTP::host] "."]
}
}To test this with logging, you can use this:
when HTTP_REQUEST {
if { [HTTP_HOST ends_with "." }{
set host_original [HTTP::host]
set host_trimmed [string trimright [HTTP::host] "."]
log local0. "\$host_original: $host_original"
log local0. "\$host_trimmed: $host_trimmed"
HTTP::host [string trimright $host_original "."]
}
}For details on the string command, you can check the TCL man page for string (Click here).
Aaron
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