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

Can't retrive admin panel behind Nginx reverse proxy under subdirectory (possible upstream experimental) #6369

Closed
EL-File4138 opened this issue May 8, 2024 · 3 comments · Fixed by #6388

Comments

@EL-File4138
Copy link

Describe the bug
Set up an instance behind Nginx reverse proxy under the subdirectory with methods from wiki. The main project works fine, but the admin panel failed to load.
Upon further investigation, found that the assets are loaded relative to the webroot(<host>/admin/assets/...), but not to the subdirectory, which results in a failed rewrite catch for nginx.
Checking for code, admin seems like a separate Vite project. Its build option base specified absolute one level to root, which would not work aforementioned. Other options are not available either, ./ would just result in resolving to webroot without admin level, ./admin is not supported. Seems like an experimental method described in Vite project document would work but with tweaking.
Recommendation:

  • Make a fix to the path problem using the provided feature (experimental);
    • Should be the best to do, still using the current method to treat subdirectory build, but still experimental;
  • Provide a configuration to declare the use of subdirectory, rewriting the base path on the fly, for the admin panel only (Just adding a workaround instruction calling people to manually write would be helpful);
    • Quickest to do but not really recommended, more quirk to do between the main project and the admin panel;
  • Other possible fixes?

To Reproduce
Steps to reproduce the behavior:

  1. Manual install and start the instance as described in README;
  2. Configure reverse proxy with the provided config in the wiki;
  3. Open the admin panel.

Expected behavior
Admin panel should load.

Screenshots
Incorrect loading when using subdirectory deployment

Server (please complete the following information):

  • Etherpad version: v2.0.3
  • OS: CentOS 9 Stream
  • Node.js version (node --version): v18.19.1
  • npm version (npm --version): 10.2.0
  • Is the server free of plugins: It's free of plugins.

Desktop (please complete the following information):
Not relevant but here you go:

  • OS: Fedora
  • Browser [e.g. chrome, safari]: Mozilla Firefox
  • Version [e.g. 22]: 125.0.3

Smartphone (please complete the following information):
Not relevant.

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@SamTV12345
Copy link
Member

Describe the bug Set up an instance behind Nginx reverse proxy under the subdirectory with methods from wiki. The main project works fine, but the admin panel failed to load. Upon further investigation, found that the assets are loaded relative to the webroot(<host>/admin/assets/...), but not to the subdirectory, which results in a failed rewrite catch for nginx. Checking for code, admin seems like a separate Vite project. Its build option base specified absolute one level to root, which would not work aforementioned. Other options are not available either, ./ would just result in resolving to webroot without admin level, ./admin is not supported. Seems like an experimental method described in Vite project document would work but with tweaking. Recommendation:

  • Make a fix to the path problem using the provided feature (experimental);

    • Should be the best to do, still using the current method to treat subdirectory build, but still experimental;
  • Provide a configuration to declare the use of subdirectory, rewriting the base path on the fly, for the admin panel only (Just adding a workaround instruction calling people to manually write would be helpful);

    • Quickest to do but not really recommended, more quirk to do between the main project and the admin panel;
  • Other possible fixes?

To Reproduce Steps to reproduce the behavior:

  1. Manual install and start the instance as described in README;
  2. Configure reverse proxy with the provided config in the wiki;
  3. Open the admin panel.

Expected behavior Admin panel should load.

Screenshots Incorrect loading when using subdirectory deployment

Server (please complete the following information):

  • Etherpad version: v2.0.3
  • OS: CentOS 9 Stream
  • Node.js version (node --version): v18.19.1
  • npm version (npm --version): 10.2.0
  • Is the server free of plugins: It's free of plugins.

Desktop (please complete the following information): Not relevant but here you go:

  • OS: Fedora
  • Browser [e.g. chrome, safari]: Mozilla Firefox
  • Version [e.g. 22]: 125.0.3

Smartphone (please complete the following information): Not relevant.

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

Oh that is a regression. Thanks for the report. I'll try to find a solution. Maybe something with JS that replaces the url with window.href at runtime but that is something I need to check first.

@Uatschitchun
Copy link

I'll add myself to this one:

I'm running EP on Uberspace even behind a nginx proxy which adds

    location /pad/ {
        rewrite ^/pad/?(.*) /$1 break;
        proxy_pass http://server.local.uberspace.de:9001;

to nginx.conf.

Admin panel was working well with 1.9.7 but it fails with 2.x

[ERROR] settings - Error: ENOENT: no such file or directory, stat '/home/server/etherpad/src/templates/admin/index.html'`

Even with using master (#6388) included, I get a 502.
What can be done here?

@EL-File4138
Copy link
Author

@Uatschitchun The nginx config has been updated too, see Wiki. Please try modifying your nginx config.

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

Successfully merging a pull request may close this issue.

3 participants