Comments (6)
can you provide more detail? Share your code if necessary.
from ci-rest-jwt.
can you provide more detail? Share your code if necessary.
It showing cors issue only on PUT and DELETE method from angular. But while running it from postman delete method working properly and put method showing as 'You must use the "set" method to update an entry'.
Why this kind of error showing only on PUT and DELETE method?
Waiting for ur replay. thank you
from ci-rest-jwt.
CORS issue is very common, you can try to find out more about what CORS is.
as far as I knows there are two ways to solve cors issue,
- you can append header Access-Control-Allow-Origin: * from your web server (apache/nginx)
- you can append it from the framework it self
from ci-rest-jwt.
CORS issue is very common, you can try to find out more about what CORS is. as far as I knows there are two ways to solve cors issue,
- you can append header Access-Control-Allow-Origin: * from your web server (apache/nginx)
- you can append it from the framework it self
it's not work btw. i'm testing CORS in eveyway.
in frontend with
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Accept', 'application/json');
headers.append('Authorization', `Persahabatan ${token}`);
headers.append('Origin','freecluster.eu');
headers.append('Access-Control-Allow-Credentials', 'true');
headers.append('Access-Control-Allow-Origin', 'https://sahabat.freecluster.eu/');
and in backend with
public function __construct()
{
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Credentials: true ");
header("Access-Control-Allow-Methods: OPTIONS, GET, POST");
header("Access-Control-Allow-Headers: Content-Type, Depth, User-Agent, X-File-Size, X-Requested-With, If-Modified-Since, X-File-Name, Cache-Control");
// if (isset($_SERVER['HTTP_ORIGIN'])) {
// // Decide if the origin in $_SERVER['HTTP_ORIGIN'] is one
// // you want to allow, and if so:
// header("Access-Control-Allow-Origin: {$_SERVER['HTTP_ORIGIN']}");
// header('Access-Control-Allow-Credentials: true');
// header('Access-Control-Max-Age: 86400'); // cache for 1 day
// }
// // Access-Control headers are received during OPTIONS requests
// if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
// if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_METHOD']))
// // may also be using PUT, PATCH, HEAD etc
// header("Access-Control-Allow-Methods: GET, POST, OPTIONS");
// if (isset($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']))
// header("Access-Control-Allow-Headers: {$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']}");
// exit(0);
// }
// Construct the parent class
parent::__construct();
$this->auth();
}
nothing in works, but when i'm testing at heroku, it's always build failed because still php 5 in some library.
-----> Building on the Heroku-20 stack
-----> Determining which buildpack to use for this app
-----> PHP app detected
-----> Bootstrapping...
-----> Installing platform packages...
! ERROR: Failed to install system packages!
!
! Your platform requirements (for runtimes and extensions) could
! not be resolved to an installable set of dependencies, or a
! platform package repository was unreachable.
!
! This usually means that you (or packages you are using) depend
! on a combination of PHP versions and/or extensions that are
! currently not available on Heroku.
!
! The following is the full output from the installation attempt:
!
! > You are using Composer 1 which is deprecated. You should upgrade to Composer 2, see https://blog.packagist.com/deprecating-composer-1-support/
! > Loading repositories with available runtimes and extensions
! > Updating dependencies
! > Your requirements could not be resolved to an installable set of packages.
! >
! > Problem 1
! > - The requested package composer-plugin-api could not be found in any version, there may be a typo in the package name.
! >
!
! For reference, the following runtimes are currently available:
!
! PHP: 8.1.1, 8.1.0, 8.0.14, 8.0.13, 8.0.12, 8.0.11, 8.0.10,
! 8.0.9, 8.0.8, 8.0.7, 8.0.6, 8.0.3, 8.0.2, 8.0.1, 8.0.0,
! 8.0.0RC4, 7.4.27, 7.4.26, 7.4.25, 7.4.24, 7.4.23, 7.4.22,
! 7.4.21, 7.4.20, 7.4.19, 7.4.16, 7.4.15, 7.4.14, 7.4.13,
! 7.4.12, 7.3.33, 7.3.32, 7.3.31, 7.3.30, 7.3.29, 7.3.28,
! 7.3.27, 7.3.26, 7.3.25, 7.3.24
!
! Please verify that all requirements for runtime versions in
! 'composer.lock' are compatible with the list above, and ensure
! all required extensions are available for the desired runtimes.
!
! When choosing a PHP runtimes and extensions, please also ensure
! they are available on your app's stack (heroku-20), and select
! a different stack if needed after consulting the article below.
!
! For a list of supported runtimes & extensions on Heroku, please
! refer to: https://devcenter.heroku.com/articles/php-support
! Push rejected, failed to compile PHP app.
! Push failed
can you test at heroku please?
from ci-rest-jwt.
have you tried to check the header from frontend side? (inspect element, and take a look at the network while hitting the endpoint from frontend) .
I'm not sure about the heroku issue, this repo is not maintained and kinda old
@mdestafadilah
from ci-rest-jwt.
Yes it's done bro.
let headers = new Headers();
headers.append('Content-Type', 'application/json');
headers.append('Accept', 'application/json');
headers.append('Authorization', `Persahabatan ${token}`);
headers.append('Origin','freecluster.eu');
headers.append('Access-Control-Allow-Credentials', 'true');
headers.append('Access-Control-Allow-Origin', 'https://sahabat.freecluster.eu/');
have you done before with heroku?
from ci-rest-jwt.
Related Issues (12)
- I got a message ERROR 404. HOT 2
- This will be Continue? HOT 1
- Please ReadOnly or Archive this Project
- Request header files Access-Control-Allow-Origin is not allowed HOT 1
- Have Some issue with core HOT 2
- Wrong number of segments HOT 6
- PHP ver 7.2 above not working HOT 2
- authorization is not allowed JQuery Ajax ChartJS HOT 1
- The Encrypt library requires the Mcrypt extension
- Wrong number of segments HOT 2
- jwt AUTH HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ci-rest-jwt.