Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
openApi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
hj
openApi
Commits
b87383a2
Commit
b87383a2
authored
Apr 26, 2022
by
hangjun83
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
解决跨域问题
parent
31c1b639
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
70 additions
and
1 deletion
+70
-1
server/app/Console/Kernel.php
server/app/Console/Kernel.php
+1
-0
server/bootstrap/app.php
server/bootstrap/app.php
+7
-1
server/composer.json
server/composer.json
+1
-0
server/config/cors.php
server/config/cors.php
+61
-0
No files found.
server/app/Console/Kernel.php
View file @
b87383a2
...
@@ -22,6 +22,7 @@ class Kernel extends ConsoleKernel
...
@@ -22,6 +22,7 @@ class Kernel extends ConsoleKernel
* @var array
* @var array
*/
*/
protected
$commands
=
[
protected
$commands
=
[
\Laravelista\LumenVendorPublish\VendorPublishCommand
::
class
];
];
/**
/**
...
...
server/bootstrap/app.php
View file @
b87383a2
...
@@ -84,6 +84,8 @@ $app->configure('enum');
...
@@ -84,6 +84,8 @@ $app->configure('enum');
$app
->
configure
(
'permission'
);
$app
->
configure
(
'permission'
);
$app
->
configure
(
'response'
);
$app
->
configure
(
'response'
);
$app
->
configure
(
'cors'
);
$app
->
alias
(
'cache'
,
\Illuminate\Cache\CacheManager
::
class
);
$app
->
alias
(
'cache'
,
\Illuminate\Cache\CacheManager
::
class
);
/*
/*
...
@@ -100,6 +102,7 @@ $app->alias('cache', \Illuminate\Cache\CacheManager::class);
...
@@ -100,6 +102,7 @@ $app->alias('cache', \Illuminate\Cache\CacheManager::class);
$app
->
middleware
([
$app
->
middleware
([
\Jiannei\Logger\Laravel\Http\Middleware\RequestLog
::
class
,
\Jiannei\Logger\Laravel\Http\Middleware\RequestLog
::
class
,
\Jiannei\Response\Laravel\Http\Middleware\Etag
::
class
,
\Jiannei\Response\Laravel\Http\Middleware\Etag
::
class
,
\Fruitcake\Cors\HandleCors
::
class
,
]);
]);
$app
->
routeMiddleware
([
$app
->
routeMiddleware
([
...
@@ -141,7 +144,10 @@ $app->register(\Jiannei\Enum\Laravel\Providers\LumenServiceProvider::class);
...
@@ -141,7 +144,10 @@ $app->register(\Jiannei\Enum\Laravel\Providers\LumenServiceProvider::class);
$app
->
register
(
\Jiannei\Response\Laravel\Providers\LumenServiceProvider
::
class
);
$app
->
register
(
\Jiannei\Response\Laravel\Providers\LumenServiceProvider
::
class
);
$app
->
register
(
\Jiannei\Logger\Laravel\Providers\ServiceProvider
::
class
);
$app
->
register
(
\Jiannei\Logger\Laravel\Providers\ServiceProvider
::
class
);
/*
//跨域问题
$app
->
register
(
Fruitcake\Cors\CorsServiceProvider
::
class
);
/*ext
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
| Load The Application Routes
| Load The Application Routes
|--------------------------------------------------------------------------
|--------------------------------------------------------------------------
...
...
server/composer.json
View file @
b87383a2
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
"jiannei/laravel-logger"
:
"^1.2"
,
"jiannei/laravel-logger"
:
"^1.2"
,
"jiannei/laravel-response"
:
"^4.0"
,
"jiannei/laravel-response"
:
"^4.0"
,
"laravel/lumen-framework"
:
"^8.0"
,
"laravel/lumen-framework"
:
"^8.0"
,
"laravelista/lumen-vendor-publish"
:
"^8.0"
,
"league/fractal"
:
"^0.19.2"
,
"league/fractal"
:
"^0.19.2"
,
"prettus/l5-repository"
:
"^2.7"
,
"prettus/l5-repository"
:
"^2.7"
,
"spatie/laravel-permission"
:
"^5.1"
,
"spatie/laravel-permission"
:
"^5.1"
,
...
...
server/config/cors.php
0 → 100644
View file @
b87383a2
<?php
return
[
/*
|--------------------------------------------------------------------------
| Laravel CORS Options
|--------------------------------------------------------------------------
|
| The allowed_methods and allowed_headers options are case-insensitive.
|
| You don't need to provide both allowed_origins and allowed_origins_patterns.
| If one of the strings passed matches, it is considered a valid origin.
|
| If ['*'] is provided to allowed_methods, allowed_origins or allowed_headers
| all methods / origins / headers are allowed.
|
*/
/*
* You can enable CORS for 1 or multiple paths.
* Example: ['api/*']
*/
'paths'
=>
[
'adminapi/*'
],
/*
* Matches the request method. `['*']` allows all methods.
*/
'allowed_methods'
=>
[
'*'
],
/*
* Matches the request origin. `['*']` allows all origins. Wildcards can be used, eg `*.mydomain.com`
*/
'allowed_origins'
=>
[
'*'
],
/*
* Patterns that can be used with `preg_match` to match the origin.
*/
'allowed_origins_patterns'
=>
[],
/*
* Sets the Access-Control-Allow-Headers response header. `['*']` allows all headers.
*/
'allowed_headers'
=>
[
'*'
],
/*
* Sets the Access-Control-Expose-Headers response header with these headers.
*/
'exposed_headers'
=>
[],
/*
* Sets the Access-Control-Max-Age response header when > 0.
*/
'max_age'
=>
0
,
/*
* Sets the Access-Control-Allow-Credentials header.
*/
'supports_credentials'
=>
false
,
];
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment