Forum Discussion
Rewrite specific URL in SharePoint 2013
Hello,
I would like to rewrite a specific SharePoint 2013 URL from one web appplication SharePoint to another one using the LTM module on a Big-IP.
For example, the URL https://www.abc.com/siteRewrite will be rewritten to https://www.xyz.com/siteRewrite. The end user must not see the new url meaning at any time he will see https://www.abc.com/siteRewrite. The root site https://www.abc.com/ need to stay available for the user.
I have tried to do that using iRule (rewrite iRule and ProxyPass iRule). The problem is that the website is well rewritten but the content inside doesn't display properly some images, links, folders .... are missing.
You will find below the rewrite iRule used (the proxy pass iRule I have tested is the one available on the F5 website).
when HTTP_REQUEST
{
if { ("[string tolower [HTTP::host]][HTTP::path]" starts_with "www.abc.com/siteRewrite/") } {
HTTP::header remove "Accept-Encoding"
HTTP::header replace Host "www.xyz.com"
STREAM::disable
}
}
when HTTP_RESPONSE {
if { [HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains "www.xyz.com" } {
HTTP::header replace Location [string map {"www.xyz.com" "www.abc.com"} [HTTP::header Location]]
}
if { [HTTP::header "Content-Type"] starts_with "text/" } {
STREAM::expression "@www.xyz.com@www.abc.com@"
STREAM::enable
}
}
Do you know why the content is not rendering properly ? Is something missing in the iRule ? Is the APM module required for this ?
If I have a look at the web page I see 404 error (not found) on some .axd resources (ScriptResource.axd, WebResource.axd). I think the problem is linked to these SharePoint resources and the root context (because rewritting the entire website www.abc.com to www.xyz.com is working).
Is someone have an idea about it ?
Thanks
- Stanislas_Piro2Cumulonimbus
Hi,
Sharepoint have a solution to manage it without need to rewrite in reverse proxy : Alternate access mapping....
please use this sharepoint feature and not use F5 CPU... Rewriting must be a feature used only when web application does not support external URLs...
- JeremiNimbostratus
Hi,
Thanks, but I can't use alternate access mapping in this case because the main URL (https://www.abc.com/) is used. We have already tested it and SharePoint doesn't like it. The entire web site "https://www.abc.com/" is up and running externally for the users. We just want to rewrite a specific site to the new web app.
Regards
- Stanislas_Piro2Cumulonimbus
The best solution is to:
-
create a alternate access mapping with:
- internal url : https://www.xyz.com
- external url : https://www.abc.com
- rewrite Host header with the following irule:
.
when HTTP_REQUEST { if { ([string tolower [HTTP::host]] equals "www.abc.com") } { HTTP::header replace Host "www.xyz.com" } } when HTTP_RESPONSE { if { [HTTP::header exists "Transfer-encoding"] } { HTTP::payload rechunk } }
With this solution, BigIP will send request with www.xyz.com to the server but replies from sharepoint will be with
-
create a alternate access mapping with:
- JeremiNimbostratus
This solution is also not working, because we have :
Web Application www.abc.com :
- internal url : https://www.abc.com
- external url : https://www.abc.com
Web Application www.xyz.com :
- internal url : https://www.xyz.com
- external url : https://www.abc.com <- Impossible to set because the URL is already used
SharePoint says that something went wrong, the URL is already used in another web application. The same front end servers are publishing www.abc.com and www.xyz.com.
Regards
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