Skip to content
  • P
    Projects
  • G
    Groups
  • S
    Snippets
  • Help

孙龙 / note-library

  • This project
    • Loading...
  • Sign in
Go to a project
  • Project
  • Repository
  • Issues 0
  • Merge Requests 0
  • Pipelines
  • Wiki
  • Snippets
  • Settings
  • Activity
  • Graph
  • Charts
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Files
  • Commits
  • Branches
  • Tags
  • Contributors
  • Graph
  • Compare
  • Charts
Commit dfae2965 authored 2 years ago by 孙龙's avatar 孙龙
Browse files
Options
  • _('Browse Files')
  • Download
  • Email Patches
  • Plain Diff

跨域

parent 9a848bc2
Show whitespace changes
Inline Side-by-side
Showing with 17 additions and 3 deletions
  • app/Http/Middleware/CrossHttp.php
  • config/website.php
app/Http/Middleware/CrossHttp.php
View file @ dfae2965
......@@ -13,12 +13,17 @@ class CrossHttp
public function handle($request, Closure $next)
{
$response = $next($request);
$response->header('Access-Control-Allow-Origin', "*");
$response = $next($request);
$origin = $request->server('HTTP_ORIGIN') ? $request->server('HTTP_ORIGIN') : '';
$allow_origin = config("website.cros");
if(in_array($origin, $allow_origin)){
$response->header('Access-Control-Allow-Origin',$origin);
$response->header('Access-Control-Allow-Headers', 'Origin, Content-Type, Cookie,X-Requested-With, X-CSRF-TOKEN, Accept, Authorization, X-XSRF-TOKEN');
$response->header('Access-Control-Expose-Headers', 'Authorization, authenticated');
// $response->header('Access-Control-Expose-Headers', 'Authorization, authenticated');
$response->header('Access-Control-Allow-Methods', 'GET, POST, PATCH, PUT, OPTIONS');
$response->header('Access-Control-Allow-Credentials', 'true');
$response->header('Content-type:', 'text/html; charset=utf-8"');
}
return $response;
}
}
\ No newline at end of file
This diff is collapsed. Click to expand it.
config/website.php
View file @ dfae2965
......@@ -22,4 +22,12 @@ return [
// go 服务
'go_server' => 'http://127.0.0.1:8070/',
"cros" =>[
"http://order.xiaokang.liexinlocal.com",
"http://order.liexindev.net",
"https://order.liexindev.net",
"http://order.ichunt.net",
"https://order.ichunt.net",
],
];
This diff is collapsed. Click to expand it.
  • Write
  • Preview
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment