Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public /index.php
- ========
- add in top
- =======
- $allowedOrigins = array(
- 'http://localhost:600', // Laravel API Domain
- 'http://localhost:3000' // VueJS CLient
- );
- if (isset($_SERVER['HTTP_ORIGIN']) && $_SERVER['HTTP_ORIGIN'] != '') {
- foreach ($allowedOrigins as $allowedOrigin) {
- if (preg_match('#' . $allowedOrigin . '#', $_SERVER['HTTP_ORIGIN'])) {
- header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
- header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
- header('Access-Control-Max-Age: 1000');
- header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement