Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 

HTTP Header insert

mj16othman
Altostratus
Altostratus

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

1 ACCEPTED SOLUTION

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
		}
	}
}

View solution in original post

1 REPLY 1

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
		}
	}
}