Cors Laravel, release only for a specific domain

Asked

Viewed 258 times

1

I’m using the library Laravelcors and would like to block all requisites except a specific Dominio, as I do this?

1 answer

1


If the entire facility was followed barryvdh/Laravel-Cors goes in the briefcase config and open the file cors.php and in the array settings, add address in key allowedOrigins as now is in the example below the address http://www.teste.com, there can also contain other addresses, because, accepts more settings.

return [
     /*
     |--------------------------------------------------------------------------
     | Laravel CORS
     |--------------------------------------------------------------------------
     |
     | allowedOrigins, allowedHeaders and allowedMethods can be set to array('*')
     | to accept any value.
     |
     */
    'supportsCredentials' => false,
    'allowedOrigins' => ['http://www.teste.com'],
    'allowedHeaders' => ['Content-Type', 'X-Requested-With'],
    'allowedMethods' => ['*'], // ex: ['GET', 'POST', 'PUT',  'DELETE']
    'exposedHeaders' => [],
    'maxAge' => 0,
]
  • 1

    I had thought to do this, but I mentioned having a safer position... young vlw. :)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.