Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Limesurvey in virtual folder - css and js ok but any form action URL is wrong

More
7 years 3 weeks ago #189853 by jaybeede
Hi,

I'm trying to install limesurvey in a Docker container. For that I'm trying to create a limesurvey Docker image from alpine 3.7 with nginx. So you have 3 containers involved here:
- (container A) : myqsl container official image
- (container B\) : limesurvey container (image I have built) with php7 and nginx as web server. This container is linked to mysql container.
- (container C) : web proxy container nginx official image. This container is linked with several other applications (front-ends) and actually provides successfully access to theses applications, from one single domain. This container acts as a reverse proxy (HTTPS till there) to some sub-paths. So you actually have something like :
- \https://my-domain.com/ -> blog
- \https://my-domain.com/racktables/ -> racktables applications
- \https://my-domain.com/app1/ -> app 1
- \https://my-domain.com/app2/ -> app 2
- etc.


What I'm trying to do is to add \https://my-domain.com/limesurvey/ for the limesurvey application here.

So I have added the link to this new limesurvey container and edited the entry in the nginx reverse proxy container configuration (see configuration after).

In the limesurvey container, I have temporary edited the file /var/www/html/limesurvey/application/config/config-defaults.php for the installation process in order to get the css and js working.
The problem was that any form action url was wrongly recirecting to \https://my-domain.com/index.php?r=installer/welcome (for exemple) instead of \https://my-domain.com/limesurvey/index.php?r=installer/welcome.
Since it was only the install process that I will automate in the future, it didn't matter for me to manually edit the HTML (each page) with the web browser devtools.

Once installed, I have
- changed back the changes done in /var/www/html/limesurvey/application/config/config-defaults.php
- edited the URL related settings in the newly created file /var/www/html/limesurvey/application/config/config.php (see after)

So now the problem with the form action URL is still there : I can for example successfully login to the backoffice, but I still need to manually edit the HTML before clicking the "Log in" button.
Indeed the problem is still there : redirect to the wrong url :
Code:
<form id="loginform" name="loginform" action="/index.php?r=admin/authentication/sa/login" method="post">
instead of
Code:
<form id="loginform" name="loginform" action="/limesurvey/index.php?r=admin/authentication/sa/login" method="post">

How can I definitively configure that? What is the best way to configure that? container B's nginx configuration? container C's nginx configuration? Limesurvey configuration? Yii Framework configuration?


Here is the /var/www/html/limesurvey/application/config/config.php file content :
Code:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); return array( 'components' => array( 'db' => array( // my secret DB settings here... ), 'urlManager' => array( 'urlFormat' => 'get', 'rules' => array( // You can add your own rules here ), 'showScriptName' => true, ), 'request' => array( 'baseUrl' => '/limesurvey/', ), ), 'config'=>array( 'debug'=>0, 'debugsql'=>0, // Set this to 1 to enanble sql logging, only active when debug = 2 'mysqlEngine' => 'MYISAM', 'publicurl' => 'https://my-domain.com/limesurvey', 'rooturl' => 'https://my-domain.com/limesurvey' ) ); /* End of file config.php */ /* Location: ./application/config/config.php */

Here is the nginx reverse proxy configuration (container C) : /etc/nginx/nginx.conf
Code:
events { worker_connections 4096; } http { upstream service-app1 { server app1-ui:80; } upstream service-app2 { server app2-ui:8080; } upstream service-app3 { server app3-ui:8080; } upstream service-blog { server blog-ui:80; } upstream service-racktables { server racktables-ui:80; } upstream service-limesurvey { server limesurvey-test:80; } server { listen 80; listen [::]:80; server_name my-domain.com; return 301 https://$server_name$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name my-domain.com; error_log /var/log/nginx/my-domain.com-error.log; access_log /var/log/nginx/my-domain.com-access.log; ssl_certificate /etc/nginx/ssl/my-domain.com.crt; ssl_certificate_key /etc/nginx/ssl/my-domain.com.key; ssl_ciphers 'AES256+EECDH:AES256+EDH:!aNULL'; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_session_cache shared:SSL:10m; ssl_session_timeout 10m; ssl_prefer_server_ciphers on; ssl_dhparam /etc/nginx/ssl/dhparam2048.pem; ssl_ecdh_curve secp384r1; ssl_session_tickets off; ssl_stapling on; ssl_stapling_verify on; resolver 8.8.8.8 8.8.4.4 valid=300s; resolver_timeout 10s; server_tokens off; location / { proxy_pass https://service-blog; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Port $server_port; proxy_set_header Host $host; add_header X-XSS-Protection "1; mode=block"; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-Frame-Options DENY; add_header X-Content-Type-Options nosniff; } location /app3 { proxy_buffering off; proxy_pass https://service-app3; } location /app2 { proxy_pass https://service-app2; } location /app1/ { rewrite ^(app1)$ $1/ permanent; proxy_pass https://service-app1; } location /racktables/ { proxy_pass https://service-racktables/; proxy_redirect https://$host/ /racktables/; proxy_set_header Host $host; } location /limesurvey/ { proxy_pass https://service-limesurvey/; proxy_redirect https://$host/ /limesurvey/; proxy_set_header Host $host; } location /.well-known/acme-challenge { root /var/www; } location = /50x.html { root /var/www/errors; } location = /40x.html { root /var/www/errors; } } }

Here is the nginx server configuration in the limesurvey container (container B\) : /etc/nginx/nginx.conf
Code:
user www; worker_processes auto; # it will be determinate automatically by the number of core #pid /var/run/nginx/nginx.pid; # it permit you to use /etc/init.d/nginx reload|restart|stop|start events { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 3000; server { listen 80; root /var/www/html/limesurvey; index index.html index.htm index.php; server_name localhost; error_log /var/log/nginx/error.log warn; access_log /var/log/nginx/access.log; client_max_body_size 32m; error_page 500 502 503 504/50x.html; location = /50x.html { root /var/lib/nginx/html; } location / { try_files $uri $uri/ /limesurvey/index.php?r=$uri&$args; location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; include fastcgi.conf; } } } }

Thank for your help!
The topic has been locked.
More
7 years 2 weeks ago #190021 by jaybeede
Hi,
Do not hesitate to tell me if my explanations are not clear...
Have a nice day
The topic has been locked.
More
7 years 2 weeks ago #190045 by jelo
There are not many active members in this forum, which use docker/container installations of LimeSurvey.

I recommend to submit a bugreport to raise some attention.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
More
7 years 2 weeks ago #190050 by DenisChenu

jelo wrote: …
I recommend to submit a bugreport to raise some attention.

Since it's more server configuration issue …
I don't think it can be supported as bug report …

Neededing
Code:
'request' => array( 'baseUrl' => '/limesurvey/', ),
is need a complex system

My opinion is about this
Code:
proxy_redirect https://$host/ /limesurvey/;
I think proxy must be used differently …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
7 years 2 weeks ago #190053 by jelo

DenisChenu wrote: Since it's more server configuration issue …
I don't think it can be supported as bug report …

That can be only decided once a bug report is submitted. We have seen reports, where the result was a change in how the configuration of LimeSurvey adapt to the environment.

If it is no bugreport, it can be converted into a feature request.

The meaning of the word "stable" for users
www.limesurvey.org/forum/development/117...ord-stable-for-users
The topic has been locked.
More
7 years 2 weeks ago #190080 by jaybeede
The topic has been locked.
More
7 years 2 weeks ago #190084 by DenisChenu
In bug report , i see you try wit a 4.0RC1 …

Think it's better to do your test with a STABLE version …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
7 years 2 weeks ago #190089 by jaybeede
Ok, I'm downloading limesurvey from GitHub, this is probably the reason...
I have asked in the ticket the way to be able to determine the URL of the latest stable release to download programatically...
The topic has been locked.
More
7 years 3 days ago - 7 years 3 days ago #190586 by jaybeede
Last edit: 7 years 3 days ago by jaybeede.
The topic has been locked.
Moderators: holch, tpartner

Lime-years ahead

Online-surveys for every purse and purpose