Forum Discussion

Abubakar_Siddiq's avatar
Abubakar_Siddiq
Icon for Nimbostratus rankNimbostratus
Jan 28, 2025

remove www from domain

Hello Everyone,

Could you please assist for below query how it will be achieved.

 

We have a query where the customer wants to remove the www from the request. for example requested comes to https://www.abc.com and they want to remove www and forward to only abc.com. 

 

i would like to know if this is applicable using local traffic policy and irules. if possible kindly share the example irule or local traffic policy example to achieve this. 

 

Please note: there are some policies configured with https://www.abc.com/etc and being redirected to https://www.abc.com/xyz . will there be any impact on these redirections rules if we remove the www? if yes then do we need to modify all these policies to abc.com and remove www from the redirection statements.?

 

TIA.

  • Hi Abubakar_Siddiq 

     

    You can achieve your requirement using iRule as well as LTM policy.
    One of the sample iRule is given here ( Ref article ).

    In the reference example, it is redirecting from one domain to other with URI translations also.
    You can draft iRule according to your use case and use it. You can club both host and URI redirections in the same irule or keep it separated based on how do you want to manage it.

    Also, make sure your application is also accepting requests using redirected host. I have seen few cases where, app team hardcode their application to accept for specific host requests only.

     


    IMP - You need to make sure that certificate configured on the F5 should be valid for "abc.com" domain also. If it is only valid for "www.abc.com" and you redirected traffic to "abc.com" with same certificate. Client will start getting certificate error warnings.

    So you need to take this point into consideration before redirecting requests.

     

    Hope it helps!