Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-92600

When portal.proxy.path is set, many js and css returning 404

    Details

      Description

      Reproduction steps:

      1. Deploy a Liferay DXP 7.1 fix pack 9 bundle.

      2. Create a "portal-ext.properties" file and set the "portal.proxy.path" to a value (for example, "/myportal").

      3. Configure a proxy (e.g. Apache HTTP, NGINX) to connect to Liferay under a context path (for example, "/myportal").
      --> In my case I used nginx and this config in etc/nginx/sites-available/default:

      server {
              listen  80;
              server_name     localhost;
              proxy_set_header Host $http_host;
              location /myportal {
                      proxy_set_header HOST $host;
                      proxy_set_header X-Forwarded-Proto $scheme;
                      proxy_set_header X-Real-IP $remote_addr;
                      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                      proxy_pass http://localhost:8080/;
              }
      }
      

      4. Start the server, access the default Liferay page (e.g. "http://localhost/myportal") in the browser.

      5. Open the network inspector in your browser and observe that the requests for "lodash.js" and "util.js" are returning a 404 - see the attached "network-debugger-1.png" screenshot.

      6. Inspect one of the requests that returned a 404 in step (5), observe that the path to the file contained the "portal.proxy.path" value twice (e.g. "/myportal/myportal/o/frontend-js-lodash-web/lodash/lodash.js") - see the attached "network-debugger-2.png" screenshot.

      7. Check the logs of the Liferay instance. Observe that there are entries in the logs that indicate that it has encountered a 404 when trying to serve "lodash.js" and "util.js" - the requested paths still contain a single "/myportal" prefix:

      2019-03-20 09:11:03.429 WARN [https-jsse-nio-8443-exec-10][code_jsp:172] {code="404", msg="/myportal/o/frontend-js-lodash-web/lodash/lodash.js", uri=/myportal/o/frontend-js-lodash-web/lodash/lodash.js}
      2019-03-20 09:11:03.438 WARN [https-jsse-nio-8443-exec-14][code_jsp:172] {code="404", msg="/myportal/o/frontend-js-lodash-web/lodash/util.js", uri=/myportal/o/frontend-js-lodash-web/lodash/util.js}
      

      Expected results: When the "portal.proxy.path" property is provided, all resources (e.g. CSS, JS, images) are prefixed with the value of "portal.proxy.path".

      Actual results: The "lodash.js" and "util.js" file paths are prefixed with the "portal.proxy.path" value twice.

       Not reproducible on 7.1 DXP + fix pack dxp-7-7110
       Introduced with fix pack dxp-8-7110  Please look at LPS-90494, it can possibly be the root cause: https://github.com/liferay/liferay-portal-ee/pull/12612/files

       Reproduced on 7.1.x-private @ 81e2290e315afac4bf26e9923db4248ee59e7b4fe4db9a10bb1d5ba63714487b
       Reproduced on master-private @ 8da043e880f275dd356e19a28114e8d894cbe1010bd4f9ad8ec42632dcf8c28a (I think we dropped both libraries on master, but I see the very same issue on other libs like e.g. jQuery, etc ...)

        Attachments

          Activity

            People

            Assignee:
            summer.zhang Summer Zhang
            Reporter:
            roland.pakai Roland Pákai
            Participants of an Issue:
            Recent user:
            Clarissa Velazquez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              2 years, 16 weeks, 2 days ago

                Packages

                Version Package
                7.1.10 DXP FP14
                7.1.X
                7.2.X
                Master