Code Monkey home page Code Monkey logo

Comments (7)

barryvdh avatar barryvdh commented on June 9, 2024 1

With Laravel 9, you can use the built in CORS, see Laravel/laravel

from laravel-cors.

barryvdh avatar barryvdh commented on June 9, 2024

How are you extending this exactly? This wasn't really a supported use case.

from laravel-cors.

barryvdh avatar barryvdh commented on June 9, 2024

I don't think the you have the options to change any configuration at runtime right? So you're just replacing the CorsService directly?

from laravel-cors.

barryvdh avatar barryvdh commented on June 9, 2024

I could release #558 as v2.2.0 and tagged the current 2.1 as 3.0 🤔

from laravel-cors.

route33 avatar route33 commented on June 9, 2024
use Fruitcake\Cors\CorsServiceProvider as ParentCorsServiceProvider;
use Asm89\Stack\CorsService;

class CorsServiceProvider extends ParentCorsServiceProvider
{
    /**
     * Register the service provider.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom($this->configPath(), 'cors');

        $this->app->scoped(CorsService::class, function () {
            return new CorsService($this->customCorsOptions());
        });
    }

    /**
     * Get options for CorsService
     *
     * @return array
     */
    protected function customCorsOptions(): array
    {
        $options = $this->corsOptions();

        $options['allowedOrigins'] = static::allowedOrigins();

        return $options;
    }

    protected static function allowedOrigins(): array
    {
        $hosts = Cache::rememberForever('sites', function () {
        ...
        });

        return $hosts;
    }
}    

from laravel-cors.

barryvdh avatar barryvdh commented on June 9, 2024

I've tagged 2.2.0 with the original namespace. Will prepare 3.x with the new one.

from laravel-cors.

pathros avatar pathros commented on June 9, 2024

@barryvdh From composer outdated

  • major release available - update possible,

I see there's a new mayor release of fruitcake/laravel-cors.

I am using Laravel 9. Is the v.3.0.0 supported?

If so, How do I upgrade it?

from laravel-cors.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.