How to redirect non anonymous proxy traffic?

I know it’s something with HTTP_X_FORWARDED directive but not sure how
to make it work.
I need detection of it and then redirect to set URL.