Coder Social home page Coder Social logo

lm-commons / lmccors Goto Github PK

View Code? Open in Web Editor NEW
8.0 4.0 2.0 805 KB

LmcCors is a simple Laminas MVC module that helps you to deal with Cross-Origin Resource Sharing (CORS).

Home Page: https://lm-commons.github.io/LmcCors/

License: MIT License

PHP 100.00%
cors cors-requests laminas-mvc zfrcors php

lmccors's People

Contributors

renovate[bot] avatar svycka avatar visto9259 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

lmccors's Issues

How to use

Hi,

I made the following settings:

Copy lmc_cors.global to /config/autoload/lmc_cors.local.php

In /config/modules.config.php

return [ 'Laminas\Session', 'Laminas\Db', 'Laminas\I18n', 'Laminas\Filter', 'Laminas\Hydrator', 'Laminas\Mvc\Console', 'Laminas\Router', 'Laminas\Validator', 'Laminas\DeveloperTools', 'Laminas\Cache', 'LmcCors', 'Application',

In my modules.config.php /module/Login/Module.php

`<?php

/**

declare(strict_types=1);

namespace Login;

use Laminas\Router\Http\Literal;
use Laminas\Router\Http\Segment;
use Laminas\ServiceManager\Factory\InvokableFactory;
use LmcCors;

return [
'lmc_cors' => [
'allowed_origins' => ['*'],
'allowed_methods' => ['GET', 'POST', 'DELETE'],
],
'router' => [
'routes' => [
'login' => [
'type' => Segment::class,
'options' => [
'route' => '/login[/:action]',
'defaults' => [
'controller' => Controller\LoginController::class,
'action' => 'index',
\LmcCors\Options\CorsOptions::ROUTE_PARAM => [
'allowed_methods' => ['POST'],
],
],
],
],
],
],
'view_manager' => [
'display_not_found_reason' => true,
'display_exceptions' => true,
'strategies' => [
'ViewJsonStrategy',
],
],
];
`
Even so, I still receive the message that CORS is not enabled

URL de Solicitação: http://www.apivf.local/login/login Política de referenciador: strict-origin-when-cross-origin Cabeçalhos provisórios são mostrados Accept: application/json, text/plain, */* Content-Type: application/json Referer: http://www.appvf.local/ User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57

URL de Solicitação: http://www.apivf.local/login/login Método de Solicitação: OPTIONS Código de Status: 200 OK Endereço Remoto: 127.0.0.1:80 Política de referenciador: strict-origin-when-cross-origin Access-Control-Allow-Headers: Authorization Access-Control-Allow-Methods: POST Access-Control-Allow-Origin: http://www.appvf.local Access-Control-Max-Age: 0 Connection: Keep-Alive Content-Length: 0 Content-Type: text/html; charset=UTF-8 Date: Thu, 25 Mar 2021 02:48:15 GMT Keep-Alive: timeout=5, max=100 Server: Apache/2.4.46 (Win64) OpenSSL/1.1.1j PHP/7.4.15 X-Powered-By: PHP/7.4.15 Accept: */* Accept-Encoding: gzip, deflate Accept-Language: pt-BR,pt;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6 Access-Control-Request-Headers: content-type Access-Control-Request-Method: POST Cache-Control: no-cache Connection: keep-alive Host: www.apivf.local Origin: http://www.appvf.local Pragma: no-cache Referer: http://www.appvf.local/ Sec-Fetch-Mode: cors User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/89.0.4389.90 Safari/537.36 Edg/89.0.774.57

Can you help me with any tips, or something I'm doing wrong?

Thank you very much

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

composer
composer.json
  • php ^8.1 | ^8.2
  • laminas/laminas-eventmanager ^2.6.4 || ^3.2.1
  • laminas/laminas-http ^2.10
  • laminas/laminas-mvc ^2.7.15 || ^3.1.1
  • laminas/laminas-servicemanager ^2.7.9 || ^3.4.0
  • laminas/laminas-i18n ^2.9
  • laminas/laminas-log ^2.10
  • laminas/laminas-modulemanager ^2.7.2
  • laminas/laminas-serializer ^2.8
  • laminas/laminas-view ^2.8.1
  • phpunit/phpunit ^9.5.0
  • php-coveralls/php-coveralls ^2.1
  • squizlabs/php_codesniffer ^3.4
  • laminas/laminas-component-installer ^3.4
github-actions
.github/workflows/build-test.yml
  • shivammathur/setup-php v2
  • actions/checkout v4
  • actions/cache v4
.github/workflows/deploy-gh-pages.yml
  • actions/checkout v4
  • actions/setup-node v4
  • peaceiris/actions-gh-pages v4
.github/workflows/test-deploy-gh-pages.yml
  • actions/checkout v4
  • actions/setup-node v4
npm
docs/package.json
  • @docusaurus/core 3.2.1
  • @docusaurus/preset-classic 3.2.1
  • @mdx-js/react ^3.0.0
  • clsx ^2.0.0
  • prism-react-renderer ^2.3.0
  • react ^18.0.0
  • react-dom ^18.0.0
  • @docusaurus/module-type-aliases 3.2.1
  • @docusaurus/types 3.2.1
  • node >=18.0

  • Check this box to trigger a request for Renovate to run again on this repository

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.