Answer the question
In order to leave comments, you need to log in
How to hide the url where the request is sent?
I have an application in which a post request is sent to a specific url, is it possible to somehow hide this url from prying eyes and how to do it?
private void postRequest() {
RequestQueue requestQueue = Volley.newRequestQueue(MainActivity.this);
String url = "https://site.ru/";
StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(getApplicationContext(),"OK", Toast.LENGTH_SHORT).show();
}
}, error -> Toast.makeText(getApplicationContext(),"Post Data : Response Failed", Toast.LENGTH_SHORT).show()){
@Override
protected Map<String,String> getParams(){
Map<String, String> params = new HashMap<String, String>();
params.put("to", binding.post.getText().toString());
return params;
}
@Override
public Map<String,String> getHeaders() throws AuthFailureError {
Map<String, String> params = new HashMap<String, String>();
params.put("Content-Type", "application/x-www-form-urlencoded");
return params;
}
};
requestQueue.add(stringRequest);
}
Answer the question
In order to leave comments, you need to log in
You have already been given an answer to this question several times, and you ask about it again, and you just don’t want to either understand or read something on the topic.
Once again, a POST request has its own format, and the URL is an integral part of it. Otherwise, how does the client know which server to send the request to (and vice versa)? Well, all other elements of the POST request, they can be encrypted individually, but you cannot encrypt the address string.
There is one option, but you won’t like it: it’s to raise a VPN connection to a specific server, and then do whatever you want in the tunnel: POST request, SSH, Samba, whatever, no one will see anything on the side. But this will require the implementation of this VPN protocol in the client. An easier to implement (and more difficult for the user) option is to make the client work only through the VPN (how the client will establish a connection is his business), authentication can be done by login-password, identification by its key and IP inside the VPN.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question