PHP Classes

File: apps/ApiGateway/app/Http/Middleware/CorsMiddleware.php

Recommend this page to a friend!
  Classes of mohammad anzawi   PHP Hotel Booking Available   apps/ApiGateway/app/Http/Middleware/CorsMiddleware.php   Download  
File: apps/ApiGateway/app/Http/Middleware/CorsMiddleware.php
Role: Class source
Content type: text/plain
Description: Class source
Class: PHP Hotel Booking Available
Search for hotels that are available for booking
Author: By
Last change:
Date: 2 years ago
Size: 509 bytes
 

Contents

Class file image Download
<?php namespace App\Http\Middleware;

/**
 * Allow all Origin & all methods
 */
class CorsMiddleware {

    public function
handle($request, \Closure $next)
    {
       
$response = $next($request);

       
$response->header('Access-Control-Allow-Methods', 'HEAD, GET, POST, PUT, PATCH, DELETE');
       
$response->header('Access-Control-Allow-Headers', $request->header('Access-Control-Request-Headers'));
       
$response->header('Access-Control-Allow-Origin', '*');

        return
$response;
    }

}