title: Laravel 5.5 CORS issue when loading FontAwesome 4.7.0
body: <p>I get a problem. I already read a lot of reference but still get error.</p>
  <blockquote>
  <p>Access to font at 'http://192.168.0.1/fonts/fontawesome-webfont.woff2?v=4.7.0' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.</p>
  </blockquote>
  <p>What i have done?</p>
  <p><strong>First Effort</strong></p>
  <blockquote>
  <p>I try to make new file .htaccess in /public/font folder.</p>
  </blockquote>
  <p>Inside .htaccess i write :</p>
  <pre><code>&lt;FilesMatch &quot;\.(ttf|otf|eot|woff|woff2)$&quot;&gt;
      &lt;IfModule mod_headers.c&gt;
          Header set Access-Control-Allow-Origin &quot;*&quot;
      &lt;/IfModule&gt;
  &lt;/FilesMatch&gt;
  </code></pre>
  <p><strong>Second effort</strong></p>
  <p>I try to use Middleware, create new file call CORS.php</p>
  <p>Inside CORS.php i write</p>
  <pre><code>&lt;?php
  namespace App\Http\Middleware;
  
  use Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode as Middleware;
  use Closure;
  use Illuminate\Support\Facades\Response;
  use Log;
  
  class CORS extends Middleware {
  
      /**
       * Handle an incoming request.
       *
       * @param  \Illuminate\Http\Request  $request
       * @param  \Closure  $next
       * @return mixed
       */
      public function handle($request, Closure $next)
      {
          Log::info(&quot;CORS 1&quot;);
  
          $origin = $request-&gt;header('origin');
          Log::info(&quot;Origin in CORS : $origin&quot;);
          $origin = $origin ?? '*';
  
          // ALLOW OPTIONS METHOD
          // $headers = [
          //     'Access-Control-Allow-Origin' =&gt; $origin,
          //     'Access-Control-Allow-Methods'=&gt; 'GET, POST, DELETE, PUT, OPTIONS, HEAD, PATCH',
          //     'Access-Control-Allow-Headers'=&gt; 'Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Set-Cookie',
          //     'Access-Control-Allow-Credentials'=&gt; 'true'
          // ];
  
          $headers = [
              'Access-Control-Allow-Origin' =&gt; $origin,
              'Access-Control-Allow-Methods'=&gt; 'GET, POST',
              'Access-Control-Allow-Headers'=&gt; 'Authorization,DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Set-Cookie',
              'Access-Control-Allow-Credentials'=&gt; 'true'
          ];
  
          if($request-&gt;getMethod() == &quot;OPTIONS&quot;) {
              // The client-side application can set only headers allowed in Access-Control-Allow-Headers
              return Response::make('OK', 200, $headers);
          }
  
          $response = $next($request);
  
          foreach($headers as $key =&gt; $value) {
              $response-&gt;header($key, $value);
          }
  
          Log::info(&quot;CORS&quot;);
          Log::info($response);
          return $response;
      }
  
  }
  </code></pre>
  <p><strong>Result :</strong></p>
  <blockquote>
  <p>First effort and Second Effort still not works. Second effort only
  works for API request (if you add GET and OPTIONS in API).</p>
  </blockquote>
  <p><strong>My Question :</strong></p>
  <blockquote>
  <p>My goal is i want to access fontawesome from other Laravel Server.
  What's my fault?</p>
  </blockquote>