# |
Jul 9th 2019, 14:07 |
jeremy.payne |
Cake version is `2.6.8` if that helps |
# |
Jul 9th 2019, 14:07 |
jeremy.payne |
but I could allow it on the whole project |
# |
Jul 9th 2019, 14:06 |
jeremy.payne |
@admad I have a whole `API` plugin with all the stuff that would require the `options` method to work |
# |
Jul 9th 2019, 14:06 |
admad |
@jeremy.payne do you need separate configurations per url? |
# |
Jul 9th 2019, 14:06 |
jeremy.payne |
Yeah I tried building a middleware in cake2 first because that's how I would tackle it in cake3 :slightly_smiling_face: |
# |
Jul 9th 2019, 14:05 |
jeremy.payne |
Yeah I tried that in the controller's beforeFilter, but it gets a 405 before it even gets that far. |
# |
Jul 9th 2019, 14:05 |
neon1024 |
Would make a nice middleware if you were in Cake 3 :slightly_smiling_face: |
# |
Jul 9th 2019, 14:05 |
neon1024 |
`$this->request->is('options')` presumably |
# |
Jul 9th 2019, 14:05 |
neon1024 |
https://book.cakephp.org/2.0/en/controllers/request-response.html#inspecting-the-request |
# |
Jul 9th 2019, 14:03 |
neon1024 |
My Cake 2 is very rusty |
# |
Jul 9th 2019, 14:03 |
neon1024 |
`$this->RequestHandler->allowMethod()` perhaps |
# |
Jul 9th 2019, 14:03 |
neon1024 |
I think it’s the RequestHandlerComponent in Cake 2? |
# |
Jul 9th 2019, 14:02 |
neon1024 |
As you might have the Cake 2 equivalent of `$this->getRequest()->allow(['post', 'put'])` or similar |
# |
Jul 9th 2019, 14:02 |
neon1024 |
Then probably just need to update the controller methods if the verbs are not set in the routing |
# |
Jul 9th 2019, 14:02 |
jeremy.payne |
A blanket permission would be a terrible idea |
# |
Jul 9th 2019, 14:01 |
jeremy.payne |
We plan (or already have the code set up) for allow-origin headers :slightly_smiling_face: |
# |
Jul 9th 2019, 14:01 |
neon1024 |
Unless you’re also implementing the Allow-Origin headers |
# |
Jul 9th 2019, 14:00 |
neon1024 |
As you have to allow it, I could send 100,000 OPTIONS requests to your enedpoint |
# |
Jul 9th 2019, 14:00 |
neon1024 |
As opening your endpoint up to OPTIONS requests will allow for hammering and ddos |
# |
Jul 9th 2019, 13:59 |
neon1024 |
We sidestepped the whole issue by proxying the call in a controller using php |
# |
Jul 9th 2019, 13:59 |
neon1024 |
I’d first think about why you need to do cross origin ajax requests |
# |
Jul 9th 2019, 13:58 |
jeremy.payne |
Hi all, I have to work on an old (Cakephp2) project and allow preflight `OPTIONS` requests on the api. As it stands those get a "405 method not allowed" back, and googeling isn't helping. What are some simple steps I can follow to pinpoint the problem? The `routes.php` file has several hundred `Router::connect()` rules but nothing regarding post/get/put. |
# |
Jul 9th 2019, 13:49 |
half2me |
would be nice if we could reproduce this somehow in a separate piece of code |
# |
Jul 9th 2019, 13:49 |
half2me |
Nope, but it seems a few people are having this strange issue. Right now I just left the atomicity set to false, because I didn’t have time to debug properly |
# |
Jul 9th 2019, 13:30 |
devito |
collin |
# |
Jul 9th 2019, 12:16 |
dereuromark |
I once blogged about it: https://www.dereuromark.de/2013/02/17/cakephp-and-tree-structures/#setup |
# |
Jul 9th 2019, 12:12 |
madbbb |
I didn't read MMPT article and thought that these fields are keys to left and right parent :,) |
# |
Jul 9th 2019, 12:09 |
dereuromark |
yes |
# |
Jul 9th 2019, 12:09 |
madbbb |
and left lft and right as int? |
# |
Jul 9th 2019, 12:05 |
dereuromark |
i am sure it does, if the parent id also is using the right type |
# |
Jul 9th 2019, 12:04 |
madbbb |
Hello. Is it possible to use TreeBehaviour with UUID primary key? |
# |
Jul 9th 2019, 11:24 |
neon1024 |
I’d also double check the class namespaces too, just in case |
# |
Jul 9th 2019, 11:23 |
neon1024 |
I would have used `collection_parts`, `CollectionPartsController` and `CollectionPartsTable` |
# |
Jul 9th 2019, 11:23 |
neon1024 |
As it’s not a word, it will not be inflected correctly, would be my guess |
# |
Jul 9th 2019, 11:22 |
mrfeedback |
any ideas? |
# |
Jul 9th 2019, 11:22 |
mrfeedback |
does somebody had the case that a model within a baked controller isn´t loaded by default? in mycase I got a model named "Collectionparts" and according to that also a controller `CollectionpartsController` within thiscontroller i always need to use `$this->loadModel('Collectionparts');` in order to access the model |
# |
Jul 9th 2019, 11:18 |
conehead |
Well, guess I can get a List of all Tables with: ` $tables = ConnectionManager::get('default')->schemaCollection()->listTables();` From here on I should be able to get the correct Table |
# |
Jul 9th 2019, 11:10 |
conehead |
Hm is there a way to check which plugins have been loaded within a controller? I got a singularized class name, but not its namespace. I now need to find the correct table to this model without using inflector. I would have tried to check which plugins are loaded and check in each `Model` folder if my class exists and if I found the class, I need to get the `Table` for this entity |
# |
Jul 9th 2019, 11:06 |
neon1024 |
Join the eternal quest to find an email validation regex! :crossed_swords: |
# |
Jul 9th 2019, 11:05 |
dereuromark |
the right upgrade regex probably goes for millions on the black market :P |
# |
Jul 9th 2019, 11:05 |
dereuromark |
a collection of regex is worth gold :) |