Forum Discussion
Irule ending with trailing slash
Hi Kevin,
Thanks for your update but unfortunately it did not worked and getting multiple redirections with infinite loops to meet below condition:
"If trailing slash and upper case is present then it needs to be redirect to lower case with trailing slash"
Could you please suggest any other way by modifying previusly shared irule to meet our requirement.
Again, thank you very much for your unconditional support and prompt response.
Perhaps best thing to do now would be to inject some logging and see what's going on.
when HTTP_REQUEST {
log local0. "============================="
log local0. "Incoming request: [HTTP::uri]"
if { ( [HTTP::method] ne "POST" ) and ( [HTTP::uri] contains "*/Webresources.axd" ) } {
log local0. "-- request is POST and contains */Webresources.axd"
HTTP::redirect "https://[HTTP::host][HTTP::uri]]"
} elseif { not ( [HTTP::uri] ends_with "/" ) && \
not ( [HTTP::method] eq "POST" ) && \
not ( [HTTP::uri] contains "/EPiServer.Forms/" ) && \
not ( [HTTP::uri] contains "?" ) && \
not ( [HTTP::uri] contains "/api/" ) && \
not ( [class match [string tolower [HTTP::path]] ends_with /DMZ/extensions] )
} {
log local0. "-- request is not POST, doesn't end with / and doesn't contain (?, /api/, /EPiServer.Forms/)"
HTTP::respond 301 Location "https://[HTTP::host][string tolower [HTTP::uri]]/"
} elseif { ( [HTTP::uri] ends_with "/" ) && ( [HTTP::uri] ne [string tolower [HTTP::uri]] ) } {
log local0. "-- request ends with / and not lowercase"
HTTP::respond 301 Location "https://[HTTP::host][string tolower [HTTP::uri]]"
}
}
View the logs:
tail -f /var/log/ltm
Please post what you find.
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