Is it possible to ban people from visiting your glitch site
It depends on what you mean by ban and what language you are using.
HTML and JS. (more text for discourse
What kind of JavaScript? (node, react, etc.)
Just regular JS (more text
What kind of ban do you want?
What do you mean? by that
Well there are different types of bans. Ban is a broad category.
I just want it if ban someone it just redirects some where else
Like an IP ban?
Yes (More text for no reason)
If you plan to run an IP ban in vanilla JS I highly recommend you do not do that. Viewers can see IPs in the source.
Then what do you recremond
IP bans can really only be done in a backend language or a config file like .htaccess
Enforcing an IP ban isn’t fully possible either, because anyone can use a VPN.
But you can’t do .htaccess in glitch
There are not many other effective ways to ban
If you use lamp-poc (the apache server in glitch) you can.
So I can’t ban people from my site in glitch.com
I’m just a bit confused at what you are asking.
Do you want to ban people from viewing:
your-project.glitch.me or
glitch.com/~your-project
I wanna ban people from actually VIEWING the site
EX: something.glitch.me
Well you can do it in PHP, NodeJS. Which language do you want to do the ban in, because you can’t do it in client-side JS.
PHP Please (more text
<?php
$ip = explode(",", $_SERVER['HTTP_X_FORWARDED_FOR']);
$deny = array("111.111.111", "1.2.3.4");
if(in_array($ip[0],$deny))
{
header("location: http://www.example.com/");
exit;
}
?>
(replacing the dummy IPs with the IPs of the people you want to ban)
OK so I just make a .php file and put that in it
You have to install PHP on your project too. There are two ways to do it:
-
Just install PHP
-
Use Apache (this gives you more options)
Which one would you like?
Yes and no.
You can ban by IP but they can use a VPN. So you’ll have to use a VPN blocker, which will lower traffic to your site as many people do use VPN’s.
I belive that @Fionn already brought this up. The other way to do this would be to do a browser fingerprint ban, but I’m not sure if that is possible and if it is, it is likely very difficult.
I personally doubt that a browser fingerprint ban would work with glitch.
The IP ban will also only work on the *.glitch.me domain because of the reverse proxy used for custom domains.
So, to simplify it; You can ban people from your site but most methods can be bypassed.
Or will not work.
Exactly. (more text)
@RiversideRocks I would just like to install php
Add this to your glitch.json
file.
{
"install": "echo 'We Are Ready!'",
"start": "php -S 0.0.0.0:3000 -t ."
}
is that it @RiversideRocks
Yes, that should work.
ok (more textTHIS IS VERY ANNOYING ()).
Is this for Kidz? Like - we talked earlier?
nope more text!!!