Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ckfinder not working - nginx error #133

Open
le-zell opened this issue Nov 16, 2022 · 6 comments
Open

ckfinder not working - nginx error #133

le-zell opened this issue Nov 16, 2022 · 6 comments

Comments

@le-zell
Copy link
Contributor

le-zell commented Nov 16, 2022

using nginx + docker 5.4.10 version

When accessing to "browse the server" to upload images for example.

The page on URI : /third_party/kcfinder/browse.php?type=images&CKEditor=description_fr&CKEditorFuncNum=2&langCode=fr has missing js and css files witch are rendered by css/index.php and js/index.php files.

in logs we have nginx errors :

rewrite or internal redirection cycle while internally redirecting to "index.php"

maybe an nginx error configuration

@martialblog
Copy link
Owner

Hi, could this be related to the issue #131 ? There also was some mentioning of the ckfinder plugin.

My first instinct is to thing about the BASE_URL and PUBLIC_URL parameters. However, there are also issues reported with the app not playing nicely with reverse proxies regardless of the parameters. Could be related.

Regards

@le-zell
Copy link
Contributor Author

le-zell commented Nov 17, 2022

Yes i think so.

It's maybe relative to a config parameter ''urlFormat' => 'path', witch shortcuts the URIs...don't know...

as a workaround i hacked third_party/kcfinder/tpl/tpl_browser.php and put <base href="/third_party/kcfinder/"> instead of <base href="<?= Yii::app()->request->getBaseUrl() ?>/">

I get a more fonctionnal webpage (with css/js resources). But the module is not working better...

@martialblog
Copy link
Owner

There's probably a way to tell the Yii::app that it is running behind a proxy, so that the routing is handled correctly.

@bovender
Copy link

bovender commented Sep 29, 2023

I cannot get it to work either.

The 500 error reported at the top of this issue seems to be an nginx server config issue. The nginx config file has a location ~ \.php$ {...} directive which contains the line try_files $uri /index.php. When I change this to try_files $uri /index.php?$args, the 500 error no longer occurs, but a 404 error occurs instead. And in my opinion this is the root of the problem:

Script /vendor/kcfinder/browse.php attempts to access the following files:

  • index.php
  • css.php
  • js_localize.php
  • js.php

All of these throw a 404 error, because browse.php references them in the root folder (example.com/), but in fact they reside in /vendor/kcfinder. It's not so much about the server domain, it's the path prefix that is missing.

I see this with @martialblog's LimeSurvey 6.x as well as 5.x images.

What puzzles me is that the LimeSurvey image by @adamzammit does not exhibit this behavior. I tried to find out what the differences are between the images by @martialblog and @adamzammit, but I was unable to see anything that might be relevant (e.g., different configuration or so).

This is what the 'ressources' page of a survey looks like in my browser with @martialblog 's image (the buttons are not functional):

image

And this is a screenshot of LimeSurvey running in a container based on @adamzammit's image (buttons are functional):

image

To summarize, there seems to be a directory issue with the kcfinder plugin in this image.

@bovender
Copy link

P.S. Here's a docker-compose.yml file that helps to quickly try out the two different images:

(expand)

version: '2'

services:

  adamzammit:
    image: adamzammit/limesurvey
    ports:
      - 127.0.0.1:9090:80
    environment:
      LIMESURVEY_DB_PASSWORD: example
      LIMESURVEY_ADMIN_USER: admin
      LIMESURVEY_ADMIN_PASSWORD: admin
      LIMESURVEY_ADMIN_NAME: Admin
      LIMESURVEY_ADMIN_EMAIL: admin@example.com
    depends_on:
      - mysql

  martialblog:
    image: docker.io/martialblog/limesurvey:latest
    environment:
      - DBENGINE=InnoDB
      - DB_TYPE=mysql
      - DB_HOST=mysql
      - DB_PASSWORD=example
      - DB_NAME=martialblog
      - DB_USERNAME=root
      - ADMIN_USER=admin
      - ADMIN_NAME=Admin
      - ADMIN_PASSWORD=admin
      - ADMIN_EMAIL=admin@example.com
      - PUBLIC_URL=foobar.com
    ports:
      - 127.0.0.1:9091:8080
    depends_on:
      - mysql

  mysql:
    image: mariadb
    environment:
      MYSQL_ROOT_PASSWORD: example

Start up these services in the usual way, invoke http://localhost:9090/admin and http://localhost:9091/admin, log in with admin/admin, quickly create new surveys, and go to the 'Resources' page to see whether ckfinder works or does not work.

@bovender
Copy link

I've never been able to figure out why one image works (with regard to this issue) and the other doesn't, despite diff'ing entire directory trees.

However, in case anyone else besides me experiences problems with this, I've forked @adamzammit's
limesurvey-docker repository and added Postgres support. In this container, the resources page works. I've created a PR on the original repository: adamzammit/limesurvey-docker#51

Works well on my server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants