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

The BASE_URL config seem to be broken in at least 6.x #184

Open
fkrauthan opened this issue Mar 5, 2024 · 8 comments
Open

The BASE_URL config seem to be broken in at least 6.x #184

fkrauthan opened this issue Mar 5, 2024 · 8 comments

Comments

@fkrauthan
Copy link

It seems like the BASE_URL env variable currently maps to:

request -> baseUrl in config.php.

However when I didn't modify it I had a bunch of links broken as well as question preview images did not load correctly (I am using traefik and the apache image).

However changing that to

request -> hostInfo while appending a trailing / solved all issues for me. So maybe that config has changed and the entrypoint.sh needs to be updated?

@martialblog
Copy link
Owner

Hi, might be, I'm not using LS in my day to day. Last time I checked the LS documentation on these variables mostly points to the Yii Framework docs.

Since there are a bazillion config options in the Framework which we can't have as Env Variables in the Image, it's usually best to just mount a config.php.

So you are saying the hostInfo needs to be set instead of baseUrl? Or both? If you have a working example we can include it in the repo.

@fkrauthan
Copy link
Author

I only set hostInfo instead of baseUrl (it is also the one mentioned in the docs as the param to use: https://manual.limesurvey.org/Optional_settings#Request_settings)

@martialblog
Copy link
Owner

I'll try to replicate things and update the docs then.

@strickes
Copy link

@fkrauthan I think I got the same problem. I can not upload pictures because the buttons are just not working, everything else seems to work fine.

I have a running Traefik setup with the following docker-compose

services:
  limesurvey:
    image: martialblog/limesurvey:6-apache
    restart: unless-stopped
    volumes:
      - ./upload/surveys:/var/www/html/upload/surveys
      - ./config.php:/var/www/html/application/config/config.php
    depends_on:
      - lime-db
    networks:
      - internal
      - web
    environment:
      - DB_HOST=lime-db
      - DB_PASSWORD=${DB_PASSWORD}
      - DB_NAME=limesurvey
      - DB_USERNAME=limesurvey
      - ADMIN_USER=admin
      - ADMIN_NAME=Admin
      - ADMIN_EMAIL=XXX@XXX.de
      - ADMIN_PASSWORD=${LIMESURVEY_ADMIN_PASSWORD}
    labels:
      - traefik.enable=true
      - traefik.http.routers.${WEBSITE}.rule=Host(`${URL}`)
      - traefik.http.routers.${WEBSITE}.tls=true
      - traefik.http.routers.${WEBSITE}.tls.certresolver=lets-encrypt
      - traefik.http.services.${WEBSITE}-limesurvey.loadbalancer.server.port=8080
  lime-db:
    image: mariadb:10.5
    restart: unless-stopped
    environment:
      - "MYSQL_USER=limesurvey"
      - "MYSQL_DATABASE=limesurvey"
      - "MYSQL_PASSWORD=${DB_PASSWORD}"
      - "MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}"
    networks:
      - internal
    volumes:
      - ./db:/var/lib/mysql

networks:
  web:
    external: true
  internal:
    external: false

config.php

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
return array(
  'components' => array(
    'db' => array(
      'connectionString' => 'mysql:host=lime-db;port=3306;dbname=limesurvey;',
      'emulatePrepare' => true,
      'username' => 'limesurvey',
      'password' => 'XXX',
      'charset' => 'utf8mb4',
      'tablePrefix' => 'lime_',
    ),
    //'session' => array (
    //   'class' => 'application.core.web.DbHttpSession',
    //   'connectionID' => 'db',
    //   'sessionTableName' => '{{sessions}}',
    //),
    'urlManager' => array(
      'urlFormat' => 'path',
      'rules' => array(),
      'showScriptName' => true,
    ),
    'request' => array(
      'baseUrl' => '',
      'hostInfo' => 'https://XXX.de/',
     ),
  ),
  'config'=>array(
    'publicurl'=>'',
    'debug'=>0,
    'debugsql'=>0,
    'mysqlEngine' => 'MyISAM',
  )
);

I create a config.php and used the hostInfo entry like you said, however I still can't upload any pictures as I have the same problem as before, how did you fix it?

@fkrauthan
Copy link
Author

@strickes I haven't tried image uploads itself. But at least for me my settings are slightly different.

  • showScriptName set to false
  • baseUrl is removed
  • publicurl is set to the same as hostInfo minus the trailing slash

Maybe try that modifications and see if it solves it?

@strickes
Copy link

@strickes I haven't tried image uploads itself. But at least for me my settings are slightly different.

  • showScriptName set to false
  • baseUrl is removed
  • publicurl is set to the same as hostInfo minus the trailing slash

Maybe try that modifications and see if it solves it?

thank you so much! This absolutely did the trick and worked like a charm. Now I can finally upload pictures and attachments to the surveys

@GuillaumeV-cemea
Copy link

Hey, I had the same issue (limesurvey 6.4 to 6.5). It seems like the only needed modification for me is removing 'baseUrl', no need to set publicurl/hostInfo or set showScriptName to false. My config.php is as follows :

<?php if (!defined('BASEPATH')) exit('No direct script access allowed');
return array(
  'components' => array(
    'db' => array(
      'connectionString' => 'mysql:host=lime-db;port=3306;dbname=limesurvey;',
      'emulatePrepare' => true,
      'username' => 'limesurvey',
      'password' => 'limesurvey',
      'charset' => 'utf8mb4',
      'tablePrefix' => 'lime_',
    ),
    //'session' => array (
    //   'class' => 'application.core.web.DbHttpSession',
    //   'connectionID' => 'db',
    //   'sessionTableName' => '{{sessions}}',
    //),
    'urlManager' => array(
      'urlFormat' => 'path',
      'rules' => array(), 
      'showScriptName' => true,
    ),
  ),
  'config'=>array(
    'debug'=>0,
    'debugsql'=>0,
    'mysqlEngine' => 'MyISAM',
  ) 
);

@martialblog
Copy link
Owner

Thanks for the example. I'll have a look at it and update the examples/defaults

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

4 participants