For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

mj16othman's avatar
mj16othman
Icon for Altostratus rankAltostratus
Apr 10, 2022
Solved

HTTP Header insert

HI all 

Guys im facing an issue. I have a domain lets say "abc.osm.com" Now currently when the users type in their browser "abc" its automatically  opens the website for them.

I want to create an irule in which once they type in "abc" in their browser, that its automatically inserts "osm.com" inside the header regardless of the full url path. 

Example: 

http://abc/SalesChannel/portal/home.action
http://abc/Portal/backoffice/Home.action

After 

http://abc.osm.com/SalesChannel/portal/home.action
http://abc.osm.com/Portal/backoffice/Home.action

  • Hi mj16othman,

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "abc" } {
    		HTTP::redirect http://abc.osm.com[HTTP::uri]
    		return
    	}
    }

    If you need it for many hostnames:

    when HTTP_REQUEST {
    	switch [HTTP::host] {
    		"abc" -
    		"def" -
    		"xyz" {
    			HTTP::redirect http://[HTTP::host].osm.com[HTTP::uri]
    			return
    		}
    	}
    }

1 Reply

  • Hi mj16othman,

    when HTTP_REQUEST {
    	if { [HTTP::host] equals "abc" } {
    		HTTP::redirect http://abc.osm.com[HTTP::uri]
    		return
    	}
    }

    If you need it for many hostnames:

    when HTTP_REQUEST {
    	switch [HTTP::host] {
    		"abc" -
    		"def" -
    		"xyz" {
    			HTTP::redirect http://[HTTP::host].osm.com[HTTP::uri]
    			return
    		}
    	}
    }