Quantcast
Channel: DreamFactory Forum - Latest posts
Viewing all articles
Browse latest Browse all 5027

CORS setting done via DSP admin console: select * from "cors_config" where enabled = 1 not working when using postgresql as system database

$
0
0

Looking at logs and some fiddling, I came to know that before receiveing a request, dreamfactory instance queries its system database(which in my case is postgresql 9.5.x) using the below SQL query :
select * from "cors_config" where enabled = 1

There is a table named "cors_config" created by dreamfactory setup, in which cors entries are stored for that particular dreamfactory instance.

There is a column/field in this table named 'enabled' of boolean type with default value true. When a admin user creates a cors entry through admin console, that entry is stored as a record in cors_config table.

The only way to query a boolean field in postgresql is :
select * from "cors_config" where enabled = '1'; or
select * from "cors_config" where enabled = true;
OR
select * from "cors_config" where enabled = 1::BOOLEAN;
OR
select * from "cors_config" where enabled = CAST( 1 AS BOOLEAN );

Rest all query including the one that dreamfactory instance makes, will fail.

AND when ths query fails, the instance interpretes that cors setting are not enabled, and thus deny headers.

NOW my question is is there is a way to modify this sql query made by DSP instance ?
select * from "cors_config" where enabled = 1
This query should be (in case of postgresql):
select * from "cors_config" where enabled = '1'; or
select * from "cors_config" where enabled = true; or
select * from "cors_config" where enabled = 1::BOOLEAN; or
select * from "cors_config" where enabled = CAST( 1 AS BOOLEAN );

It is to be noted that dreamfactory instance is persisting cors entry to postgresql database, I have checked it. So the issue is with this query only.

Please suggest some way as I am quiet new to PHP ecosystem.

Thanks


Viewing all articles
Browse latest Browse all 5027

Trending Articles