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

Etherpad-lite version 2.2.2 doesn't work anymore with nginx subdirectory url configuration (unable to load indexBootstrap-XZV.min.js) #6591

Closed
brknkfr opened this issue Aug 17, 2024 · 16 comments

Comments

@brknkfr
Copy link

brknkfr commented Aug 17, 2024

Describe the bug
I have serveral etherpad-lite instances. The main instance is under https://pad.domain.tld and there are other instances under https://pad.domain.tld/instance1/, https://pad.domain.tld/instance2/ and https://pad.domain.tld/instance3/. After upgrading to etherpad-lite version 2.2.2 only the main instance is still working, the subfolder instances fail to load indexBootstrap-XYZ.min.js. This is probably due to the javascript change in version 2.2.2. Please help.

  • Main instance: https://pad.domain.tld successfully loads indexBootstrap-MAIN.min.js from https://pad.domain.tld/indexBootstrap-MAIN.min.js
  • Subdirectory instance: As an example the instance under https://pad.domain.tld/instance/ tries to load indexBootstrap-OTHERINSTANCE.min.js from https://pad.domain.tld/indexBootstrap-OTHERINSTANCE.min.js (without instance subfolder path) which fails (HTTP error code 404). BUT the indexBootstrap-OTHERINSTANCE.min.js is reachable from https://pad.domain.tld/instance/indexBootstrap-OTHERINSTANCE.js (with subdirectory path /instance).

To Reproduce
Steps to reproduce the behavior:

  1. Install a custom etherpad-lite instance on a subdirectory, for example https://pad.domain.tld/instance/
  2. Configure nginx to serve etherpad-lite from a subdirectory as described in https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy#from-subdirectory-url
  3. Try to use https://pad.domain.tld/instance/
  4. See that the instance failes to load https://pad.domain.tld/instance/ in the browser network console.

Expected behavior
Version 2.2.2 should still work in subdirectory/subfolder installations.

Server (please complete the following information):

  • Etherpad version: 2.2.2
  • OS: Debian 12
  • Node.js version v18.19.0

Edit: Possibly related to #6588, #5359

@brknkfr brknkfr changed the title Etherpad-lite version 2.2.2 doesn't work anymore with nginx subfolder configuration (unable to load indexBootstrap-XZV.min.js) Etherpad-lite version 2.2.2 doesn't work anymore with nginx subdirectory url configuration (unable to load indexBootstrap-XZV.min.js) Aug 17, 2024
@SamTV12345
Copy link
Member

Feel free to try on develop. That should be fixed.

@brknkfr
Copy link
Author

brknkfr commented Aug 18, 2024

On a first try, applying 3dae23a seems to help. I'll wait for the next release until I close the ticket. Apparently there are some plugins which do not work.

@SamTV12345
Copy link
Member

On a first try, applying 3dae23a seems to help. I'll wait for the next release until I close the ticket. Apparently there are some plugins which do not work.

Thanks for the reply. Do you have any more plugins not working? If yes then just list them in a new issue and I'll fix them.

@n-goncalves
Copy link

I have the same issue but using etherpad's Docker image instead of installing it myself.

Applying the above commit and then building the image didn't help.

@JannesAlthoff
Copy link

I still have the same error in the develop branch. If I open a pad in the develop branch, it only shows the loading screen. In the console it shows the error "https://xxx/padbootstrap-OwAkEXFiro8.min.js not found", https://xxx/etherpad/padbootstrap-OwAkEXFiro8.min.js exists.

@Adz10kvtech
Copy link

Current Setup:

  • Etherpad is running as a Docker service

  • Nginx is configured to proxy requests to Etherpad under a subfolder:

    ```
    location /etherpad/ {
    proxy_pass http://etherpad/;
    proxy_set_header Host $host;
    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;
    }
    ```
    

The main Etherpad page seems to load, but it fails to fetch the padbootstrap-dWVv7D4yciw.min.js file, resulting in a 404 error.

@SamTV12345
Copy link
Member

Could you send me the index.html script section please? It says for me <script src="../../padbootstrap-EzpbEC2vM2I.min.js"></script> which should always work as it goes 2 levels up the stack which should be the subfolder path. @Adz10kvtech

@level20peon
Copy link

I also ran into this issue on master, but applying 3dae23a (and then rebuilding the assets) did not solve it for me either.

Can I provide anything in order to help debugging this?

@SamTV12345
Copy link
Member

Try the develop image or the develop branch if you are working bare metal. @yacchin1205 had also a fix for the subdirectory problem.

@n-goncalves
Copy link

Using the docker image etherpad:develop that was available 2 days ago, I was able to access pads when etherpad was configured to be served from a subdirectory however the /admin/plugins had still the same issueL

@SamTV12345
Copy link
Member

Using the docker image etherpad:develop that was available 2 days ago, I was able to access pads when etherpad was configured to be served from a subdirectory however the /admin/plugins had still the same issueL

Did you apply the patches in https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy/ ? You need to set some headers in order to have the rooting correctly for the /admin/ endpoint.

@brknkfr
Copy link
Author

brknkfr commented Sep 7, 2024

It's still now working with version 2.2.4, now I get a different error.

ReferenceError: io is not defined
at https://pad.domain.tld/subdir/padbootstrap-5LZ5AmITgSI.min.js at line 72
ErrorId: pCIxHAKsfQtQntw7iiIo
Unhandled Promise rejection
URL: https://pad.domain.tld/subdir/p/testingpad
UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0

@SamTV12345
Copy link
Member

It's still now working with version 2.2.4, now I get a different error.


ReferenceError: io is not defined

at https://pad.domain.tld/subdir/padbootstrap-5LZ5AmITgSI.min.js at line 72

ErrorId: pCIxHAKsfQtQntw7iiIo

Unhandled Promise rejection

URL: https://pad.domain.tld/subdir/p/testingpad

UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:129.0) Gecko/20100101 Firefox/129.0

That sounds actually good. It means the JavaScript is executed but runs into an error. Do you use any plugins on your instance?

@brknkfr
Copy link
Author

brknkfr commented Sep 7, 2024

Ah, I see, without plugins, it works fine. It's ep_comments_page (version 1.0.36) which causes the error. I'll probably open another bug report.. See ether/ep_comments_page#339

@n-goncalves
Copy link

Did you apply the patches in https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy/ ? You need to set some headers in order to have the rooting correctly for the /admin/ endpoint.

Sorry about the delay, I have read the wiki entry, I don't see anything really Etherpad specific to make it work behind a reverse proxy..

But the reverse proxy seems to be working as intended, the /admin/plugins pages returns a 200 status code with the below html.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Etherpad Admin Dashboard</title>
    <link rel="icon" href="/favicon.ico">
    <script type="module" crossorigin src="/admin/assets/index-a_6o1ecH.js"></script>
    <link rel="stylesheet" crossorigin href="/admin/assets/index-NApm68Ro.css">
  </head>
  <body>
    <div id="root"></div>
    <div id="loading"></div>
  </body>
</html>

As you can see, it tries to load the assets based on document root, which doesn't work if it's served from a from a subdirectory. Modifying those URLs directly in the container (/opt/etherpad-lite/src/templates/admin/index.html) allows the css to be fetched and the javascript to load, it later tries to fetch the fonts and translations, and that fails for the same reason.

By again editing the css and javascript manually, I was able to make those resources load as well, but the page is still blank, and it doesn't try to call /admin-auth as it is supposed to do. I assume other parts of the code assumes that everything is loaded from /admin .

@SamTV12345
Copy link
Member

Did you apply the patches in https://github.com/ether/etherpad-lite/wiki/How-to-put-Etherpad-Lite-behind-a-reverse-Proxy/ ? You need to set some headers in order to have the rooting correctly for the /admin/ endpoint.

Sorry about the delay, I have read the wiki entry, I don't see anything really Etherpad specific to make it work behind a reverse proxy..

But the reverse proxy seems to be working as intended, the /admin/plugins pages returns a 200 status code with the below html.

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Etherpad Admin Dashboard</title>
    <link rel="icon" href="/favicon.ico">
    <script type="module" crossorigin src="/admin/assets/index-a_6o1ecH.js"></script>
    <link rel="stylesheet" crossorigin href="/admin/assets/index-NApm68Ro.css">
  </head>
  <body>
    <div id="root"></div>
    <div id="loading"></div>
  </body>
</html>

As you can see, it tries to load the assets based on document root, which doesn't work if it's served from a from a subdirectory. Modifying those URLs directly in the container (/opt/etherpad-lite/src/templates/admin/index.html) allows the css to be fetched and the javascript to load, it later tries to fetch the fonts and translations, and that fails for the same reason.

By again editing the css and javascript manually, I was able to make those resources load as well, but the page is still blank, and it doesn't try to call /admin-auth as it is supposed to do. I assume other parts of the code assumes that everything is loaded from /admin .

You need to set the Proxy Header var x-proxy-path to your subpath. Then it will work

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

6 participants