Javascript resource location problem on subpanels

Hi there,

Php 7.2.1 , SuiteCRM 7.8.10 , in a docker container behind nginx reverse proxy.
Made the installation , everything cool, modified config.php to point to my old sugarcrm database, made a quick R&R and things are good. Ldap auth is working, even my custom lists are there so I’m quite happy.

I’m serving the CRM via https://1.2.3.4/crm (address edited obviously)
Here is the relevant snippet in nginx conf:


        location /crm {
            proxy_pass http://suitecrm/;
	    # Rewrite HTTPS requests from WAN to HTTP requests on LAN
            proxy_redirect http:// https://;
            sendfile off;
            proxy_set_header   Host             $host;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header        X-Forwarded-Proto $scheme;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
            proxy_max_temp_file_size 0;
            #this is the maximum upload size
            client_max_body_size       10m;
            client_body_buffer_size    128k;
            proxy_connect_timeout      90;
            proxy_send_timeout         90;
            proxy_read_timeout         90;
            proxy_buffer_size          4k;
            proxy_buffers              4 32k;
            proxy_busy_buffers_size    64k;
            proxy_temp_file_write_size 64k;
        }

extract from config.php:


...
 'host_name' => '1.2.3.4',
...
  'site_url' => 'https://1.2.3.4/crm',
...

BUT (there has to be a but) pagination on subpanels isn’t working as it should. For example, if I’m going to one of the accounts and open the Tickets subpanel I can’t navigate to the next results page. The button on the top right corner isn’t pointing on the good resource location.

Example button:


<button type="button" name="listViewNextButton" class="button" title="Suivant" onclick="javascript:showSubPanel('cases','/index.php?sugar_body_...

We can see here that it’s pointing to “/index.php” instead of “/crm/index.php” and then 404 !

I can’t manage to find where this location is generated and actually I don’t know if it’s the good way to tackle that issue.
Did I miss something ?

Ok found my problem and two solutions , one dirty and one I think it’s the good one.
To quick n dirty patch the problem in the source I had to edit:

include/ListView/ListViewSubPanel.php and add some str_replace to start_URL, previous_URL , next_URL and end_URL to put my missing subfolder in front of /index.php

It’s working with maximum prejudice to the code. BUT it allowed me to understand my source problem.
$base_URL is populated with $_SERVER[‘PHP_SELF’] which is polled from the container running apache, so php is seeing itself in the apache’s docroot which is / as much as I hate php it’s logical and it does what it’s asked for.
I’m serving via a reverse proxy on /crm not / that’s why these links are generated without the subfolder.

I think a good and solution would be to put suitecrm on a crm subfolder in the apache container too and correct the nginx proxy_pass accordingly.