M
M
MiJunior2019-04-16 15:37:31
Vue.js
MiJunior, 2019-04-16 15:37:31

How to hide API request URL?

There is a client side on Vue, it accesses the server side on Laravel (they are on different servers). The bottom line is that the user should not see the url on which requests are sent. It was decided to make some additional `api.php` file on the client side, and if the client accesses it, and he already accesses the server, the extra information will be hidden from users.
Question: how to implement that vue would make requests for a separate method of a php class if I do not have separate routes for its methods?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Andreev, 2019-04-16
@b0nn1e

What exactly are you hiding by accessing api.php?
What can make the client exactly-also access api.php?

S
Sergey Popov, 2019-04-16
@be_a_dancer

I'm afraid not. All requests are logged in the network tab of any browser. In addition, there is no point in hiding these requests, if someone needs it, he will reproduce it.
There is an option to make a terrible code like

$method = $_REQUEST['method'];
$result = __CLASS__::$method;
return $result;

But not worth it. Just trust that you shouldn't do this, as maintenance and debugging will be difficult.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question