/    Sign up×
Community /Pin to ProfileBookmark

How To Detect If Your Visitor Is Using A Proxy Or Not ?

Folks,

How to know if your website is being viewed through a proxy ?
Let’s say for some reason you want to ban proxies. You can’t be adding their IPs all the time as they can change.
There must be a fool proof way to detect proxies and redirect them away from yuor site.
And so, how would you do it ?

Let me know if my way is fool proof or not.
I think we should detect if any of these are set or not (if(ISSET()) somehow:

[code]
echo $_SERVER[‘GATEWAY_INTERFACE’];
echo $_SERVER[‘SERVER_ADDR’];
echo $_SERVER[‘SERVER_NAME’];
echo $_SERVER[‘SERVER_SOFTWARE’];
echo $_SERVER[‘SERVER_PROTOCOL’];
[/code]

I mean, the visitor should not be coming via a server but a browser. If via a server then that means the server is a proxy. Right ?
But how to achieve the checking ?

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@developer_webauthorNov 23.2021 — Folks,

Do you extract user ip using this or not ?
<i>
</i>$_SERVER['SERVER_ADDR'];


How you do it ?
Copy linkTweet thisAlerts:
@developer_webauthorNov 23.2021 — Folks,

Can someone show me where these should be used and where not since there are two.

Maybe one is used in some places the other is not ?
<i>
</i>$_SERVER['SCRIPT_NAME'];
$_SERVER['SCRIPT_FILE_NAME];
×

Success!

Help @developer_web spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...