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 the trailing period so that the headers match?
i.e. URL should be:
'http://www.thesite.com/Default.aspx'
2 Replies
- hoolio
Cirrostratus
It 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 - Jim_Jack_103645
Nimbostratus
Many thanks.
As usual, the guy who got the training has moved on and I have inherited the work :-)
I really appreciate the response
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