helios-ag / FMElfinderBundle

:file_folder: ElFinderBundle provides ElFinder integration with TinyMCE, CKEditor, Summernote editors
MIT License
275 stars 128 forks source link

Invalid backend response without another error message #503

Closed DWE64 closed 1 year ago

DWE64 commented 1 year ago

Good morning, Here is the problem encountered: on a dockerized development environment (apache config with php 8.2) the bundle works well, I have correct access to a user's specific folder. However, during the transfer via github of the project in preproduction, identical environment (and upload folder with permission 777 authorized at www-data:www-data for the tests), I no longer have access to the user's homeFolder. Indeed, in the url called, the target parameter remains empty. This returns me an invalid backend response with an empty but existing json data. Note that this target parameter is not empty in the development environment. But it is managed by the bundle. So why is it empty in preproduction?

Here is the screenshot of the console, as well as the config file used. Only the URL is dynamic. Here in dev, FMELFINDER_URL = "http://localhost:8092/" and it works, while in pre-prod, FMELFINDER_URL="https://www.zonedev.bookrepsta.com/" and it doesn't work anymore. Moreover, no error log goes back to the server. Whether Apache logs or Symfony logs.

image

fm_elfinder:
    assets_path: /assets
    instances:
        default:
            locale: '%locale%'
            editor: ckeditor
            #path_prefix: https://www.bookpresta.com/
            path_prefix: '%env(FMELFINDER_URL)%'
            fullscreen: true
            multi_home_folder: true
            folder_separator: "|"
            where_is_multi:
                roots: 0
            connector:
                debug: false
                roots:
                    upload:
                        #url : https://www.bookpresta.com/upload/package/{homeFolder}/
                        url : '%env(FMELFINDER_URL)%upload/package/{homeFolder}/'
                        tmb_url: '%env(FMELFINDER_URL)%upload/package/{homeFolder}/'
                        driver: LocalFileSystem
                        path: upload/package/
                        tmb_path: upload/package/.tmb/
                        upload_allow: ['image/png', 'image/jpg', 'image/jpeg']
                        upload_deny: ['all']
                        upload_max_size: 5M
                        attributes:
                            - {pattern: '..',read: true, write: true, locked: false}

Pre-production environment: Ubuntu 20.04 Framework Symfony 6 Bundle Version: "helios-ag/fm-elfinder-bundle": "12.*"

thank you in advance for your help

DWE64 commented 1 year ago

log pré prod: `[2023-05-25T08:07:54.734844+00:00] fmelfinder.INFO: FMElfinder pre-execution {"request":{"Symfony\Component\HttpFoundation\Request":"GET /efconnect/default/Alexandre%20NICOLOSO?cmd=open&target=&init=1&tree=1&_=1685002071393 HTTP/1.1\r\nAccept: application/json, text/javascript, /; q=0.01\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\r\nConnection: keep-alive\r\nCookie: PHPSESSID=u6qmpgreb1ka292cncemulqrmr\r\nHost: www.zonedev.bookpresta.com\r\nReferer: https://www.zonedev.bookpresta.com/elfinder/default/Alexandre%20NICOLOSO?CKEditor=package_compagny_form_description&CKEditorFuncNum=3&langCode=en\r\nSec-Fetch-Dest: empty\r\nSec-Fetch-Mode: cors\r\nSec-Fetch-Site: same-origin\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0\r\nX-Php-Ob-Level: 1\r\nX-Requested-With: XMLHttpRequest\r\nCookie: PHPSESSID=u6qmpgreb1ka292cncemulqrmr\r\n\r\n"},"HomeFolder":"Alexandre NICOLOSO","Instance":"default","Command":"open","isStopped":false} []

[2023-05-25T08:07:54.760968+00:00] fmelfinder.DEBUG: FMElfinder post-execution success {"request":{"Symfony\Component\HttpFoundation\Request":"GET /efconnect/default/Alexandre%20NICOLOSO?cmd=open&target=&init=1&tree=1&_=1685002071393 HTTP/1.1\r\nAccept: application/json, text/javascript, /; q=0.01\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\r\nConnection: keep-alive\r\nCookie: PHPSESSID=u6qmpgreb1ka292cncemulqrmr\r\nHost: www.zonedev.bookpresta.com\r\nReferer: https://www.zonedev.bookpresta.com/elfinder/default/Alexandre%20NICOLOSO?CKEditor=package_compagny_form_description&CKEditorFuncNum=3&langCode=en\r\nSec-Fetch-Dest: empty\r\nSec-Fetch-Mode: cors\r\nSec-Fetch-Site: same-origin\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0\r\nX-Php-Ob-Level: 1\r\nX-Requested-With: XMLHttpRequest\r\nCookie: PHPSESSID=u6qmpgreb1ka292cncemulqrmr\r\n\r\n"},"error":false,"Instance":"default","home folder":"Alexandre NICOLOSO","result":null} []`

log dev: [2023-05-25T11:47:27.490578+00:00] fmelfinder.INFO: FMElfinder pre-execution {"request":{"Symfony\Component\HttpFoundation\Request":"POST /efconnect/default/DWE64 HTTP/1.1\r\nAccept: /\r\nAccept-Encoding: gzip, deflate, br\r\nAccept-Language: fr,fr-FR;q=0.8,en-US;q=0.5,en;q=0.3\r\nConnection: keep-alive\r\nContent-Length: 26645\r\nContent-Type: multipart/form-data; boundary=---------------------------4178531684632559221372858588\r\nCookie: wp-settings-time-1=1683048527; PHPSESSID=d1160edcd7a822d0ff757e51c5a2c30f\r\nHost: localhost:8092\r\nOrigin: http://localhost:8092\r\nReferer: http://localhost:8092/elfinder/default/DWE64?CKEditor=package_compagny_form_description&CKEditorFuncNum=3&langCode=en\r\nSec-Fetch-Dest: empty\r\nSec-Fetch-Mode: cors\r\nSec-Fetch-Site: same-origin\r\nUser-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/113.0\r\nX-Php-Ob-Level: 0\r\nCookie: wp-settings-time-1=1683048527; PHPSESSID=d1160edcd7a822d0ff757e51c5a2c30f\r\n\r\n"},"HomeFolder":"DWE64","Instance":"default","Command":"upload","isStopped":false} []

olia-bn commented 1 year ago

Enabling CORS support seems like a work-around.

Can we get some feedback on this issue? It affects ^12.3.

DWE64 commented 1 year ago

It worked. THANKS. A feature that would be important to put would be a logger system to report errors... Because as soon as there is an error, debugging is done blind... Anyway thanks for the help.

bobvandevijver commented 1 year ago

Fix has been released with 12.3.2.