Forum Discussion
Collect and pass on variables from client device
- Jan 24, 2020
No, I meant to redirect with the information at the end.
Try this:
when HTTP_REQUEST priority 400 { set mac [LINK::lasthop] set ip [IP::client_addr] set url [HTTP::uri] switch -glob -- [string tolower [HTTP::host]] { "123.45.67.890" { HTTP::redirect "https://example.com/portal/step1.html?MACAddr=$mac&IPAddr=$ip&OrigURL=$url" } } }
Forgot to say...
Don't forget the mac address you will get is the last device mac address.
If the client is not in the same network as the F5, it is not going to be the client mac address.
Yes, it is possible.
You need to create an iRule to collect the data and send a HTTP response.
This link has some examples:
https://clouddocs.f5.com/api/irules/HTTP__respond.html
If the F5 is not in the same network as the client, you will not see the real client MAC address.
Hi Leonardo,
Thank you very much for your reply.
So I have a rule configured already with the following example:
when HTTP_REQUEST priority 400 {
switch -glob -- [string tolower [HTTP::host]] {
"123.45.67.890" { HTTP::redirect "https://example.com/portal/step1.html?[HTTP::uri]" }
}
}
The thing is I need it to go to the following URI https://example.com/portal/step1.html? the redirect above is currently working.
Are you saying that I can create an Irule which will do the redirect first, then it will add the following onto the end of the uri?
so in the end the final uri will look like this:
https://example.com/portal/step1.html?portal/step1.html?MACAddr=XX%XXX%XXX%XXXX%XXX%XXXX&IPAddr=123.123.123.123&OrigURL=http%3A%2F%2Fwww.msftconnecttest.com%2Fredirect
With the Macaddress and the originating IP being the client device which connected to the F5.
This information is basically redirecting to a portal.
I looked at the link you provided and I couldn't see the following, which Irule would modify the URI with the mac address as well as the originating IP and would the F5 be able to process both Irules?
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