A
A
AnilVia2022-04-03 11:46:27
PHP
AnilVia, 2022-04-03 11:46:27

Is it possible to somehow process server status codes and, depending on them, redirect to your site?

Sorry for the possibly stupid question, but can I somehow check the response code from the server on my vpn server and, in accordance with it, redirect the client to my site?

If literally, then the client requests the site, I check its response code (if possible of course) and, for example, with the 404 code, I redirect the client to my site.
I will be glad for any answers

Answer the question

In order to leave comments, you need to log in

4 answer(s)
S
Sergey, 2016-08-11
Protko @Fesor

'total_cost' => $row['new_cost'] ?? $row['total_cost'];

A
AnjeyTsibylskij, 2016-08-11
@AnjeyTsibylskij

Most likely is_numeric returns true so you can do one of the two below:

'total_cost' => $row['new_cost'] ?: $row['total_cost'],

D
DzmitryT, 2022-04-03
@AnilVia

In short, nothing is impossible in this case. You just have to slightly change the approach to setting up the server. For example, not just to masquerade the tiaffic from VPN clients, but to wrap it through iptables into a "transparent" proxy like Squid and manage the rules and acl in it wherever you can. This will not require the clients to set up a proxy, they will not even know it exists. True, there will be a number of situations with which you will have to conjure. For example, domain SSL certificates, if you want to not only redirect to an internal resource, but slip your content on the original domain name.
PS this is just a theory

A
AlexVWill, 2022-04-03
@AlexVWill

If I understood the task correctly, then you need your own DNS server, which will rewrite the DNS request.
For example, AdGuard Home can do this, it either blocks some DNS requests (for example, advertising, this is its regular function), or directs them to some other IP.

spoiler
624990bbc2a4c886762530.png

spoiler
6249913dbccdc541006761.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question