I am trying to limit the access to one of my public
sub-folder : /templates/sb-admin-2/
.
I have moved the folder under resources folder tracker
sub-folder and defined a route as fallow:
Route::middleware(['auth:admins'])->group(function () {
Route::get('/templates/sb-admin-2/{path?}', function () {
return File::get(resource_path('tracker' . ltrim($_SERVER['REQUEST_URI'])));
})->where(['path' => '.*']);
});
I have issue with loading css, browser console warning:
Resource interpreted as Stylesheet but transferred with MIME type text/html: "http://<myDomain>/templates/sb-admin-2/dist/css/sb-admin-2.css"
javascrips also have issues. I was wondering if anyone could help me to fix the issue? I'm using Laravel 5.4 and this is happening on my local environment. I'm using homestead within local environment.
Update: the content of the css are identical. however the headers are different.
After moving the folder:
Response Headers:
Cache-Control:no-cache, private
Cache-Control:no-store, no-cache, must-revalidate
Connection:keep-alive
Content-Encoding:gzip
Content-Type:text/html; charset=UTF-8
Date:Tue, 17 Oct 2017 00:21:02 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Pragma:no-cache
Server:nginx/1.13.3
Set-Cookie:XSRF-TOKEN=...; expires=Tue, 17-Oct-2017 02:21:02 GMT;
SetCookie:.. Max-Age=7200; path=/; HttpOnly
Transfer-Encoding:chunked
X-Powered-By:PHP/7.1.10-1+ubuntu16.04.1+deb.sury.org+1
Request Headers:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*//*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:max-age=0
Connection:keep-alive
Cookie:..
Host:<MyDomain>
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36
Before moving the folder:
Response Headers:
Accept-Ranges:bytes
Connection:keep-alive
Content-Length:781
Content-Type:text/css
Date:Tue, 17 Oct 2017 00:21:29 GMT
ETag:"59ce571f-30d"
Last-Modified:Fri, 29 Sep 2017 14:22:23 GMT
Server:nginx/1.13.3
Request Headers:
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*//*;q=0.8
Accept-Encoding:gzip, deflate
Accept-Language:en-US,en;q=0.8
Cache-Control:no-cache
Connection:keep-alive
Cookie...
Host:<MyDomain>
Pragma:no-cache
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36