mercredi 7 juin 2017

Laravel send post request to another subdomain

I have a Laravel application where I have the main app set up, and I have a subdomain that handles a specific task related to main app.

Let's say main app is: app.xyz.com and subdomain is: review.xyz.com

The question is, how can I send a post request from a controller in review.xyz.com to a route in app.xyz.com?

Here's what I have tried using Guzzle, which just silently failed (the response was just the login screen of main app. Nothing happened in ths log):

Route::post('approve', function(){
    $client = new Client(['base_uri' => env("MAIN_APP_URL")]);

    $response = $client->request('POST', 'public/approve');
    $body = $response->getBody();

    return $body;
});

How does the CSRF protection work in this case?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire