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

clicking button doesn't work when Etherpad is served from a subdirectory #3

Closed
lisandi opened this issue Sep 25, 2021 · 5 comments · Fixed by #4
Closed

clicking button doesn't work when Etherpad is served from a subdirectory #3

lisandi opened this issue Sep 25, 2021 · 5 comments · Fixed by #4

Comments

@lisandi
Copy link

lisandi commented Sep 25, 2021

We installed now a fresh Ubuntu20.04 with all requisites and etherpad-lite and all its requisites.
when installing ep_embedmedia from etherpad/admin/plugins it is installing the plugin
Screen Shot 2021-09-25 at 20 39 13
and in the frontend it shows up as a left alignment icon

Screen Shot 2021-09-25 at 20 45 27
but when clicking on it nothing is working
Not sure how the plugin actually should work as in the description the image shows not even that left alignment icon for the ep_embedmedia.
Screen Shot 2021-09-25 at 20 40 44
Perhaps that House is the embedmedia Icon - not sure what you see in the image

@slel
Copy link

slel commented Sep 25, 2021

Maybe use the issue tracker at the old Embedmedia repo

https://github.com/redhog/ep_embedmedia

until an issue tracker is opened at the new one

https://github.com/ether/ep_embedmedia

See this issue about improving this situation:

redhog#12

@rhansen rhansen transferred this issue from ether/etherpad-lite Sep 25, 2021
@ether ether deleted a comment from JohnMcLear Sep 25, 2021
@rhansen
Copy link
Member

rhansen commented Sep 25, 2021

I enabled issues for ep_embededmedia and moved this issue there.

@rhansen rhansen reopened this Sep 25, 2021
@rhansen rhansen changed the title EmbedMedia - has no issue tab on Github issue Sep 25, 2021
@rhansen rhansen changed the title issue TODO: describe this issue Sep 25, 2021
@JohnMcLear
Copy link
Member

Apologies: FWIW I can't replicate this with minify: false and maxAge: 0

Can anyone else replicate?

@lisandi
Copy link
Author

lisandi commented Sep 27, 2021

I can replicate it on all our machines. I tried to get behind that secret why it is working for you but not here but was not successful until now.

  1. We installed a completely new fresh etherpad from github
  2. we installed ONLY embedmedia - but get to the same result

what else we did:

  • cleared all files in var - but those minified files get constantly created even minified is set to false
  • we did check back on 3 other machines here in our office with same result
  • we created a new empty database and used that one but the same result

Browser is Chrome on MacOSX but we tried also Safari and Maxthon and get same results here.

But what we found out was the following - probably not related to it but perhaps it is
as we run a settings-lite.json file and credentials-lite.json file from outside the git source folders

Screen Shot 2021-09-27 at 14 29 46
we realized that the settings.json file which gets displayed in admin/settings is always the one located in the git/source folder and not the actual one which gets used.

Screen Shot 2021-09-27 at 14 26 45
When starting etherpad it shows the folders the settings and the credentials files used are located

Screen Shot 2021-09-27 at 14 30 45

We named the one located in etc/etherpad "Paddy etc"
But when checking in /admin/settings you see "Paddy original" which is the file located in the original location inside the etherpad-lite folder downloaded from GitHub.

Screen Shot 2021-09-27 at 14 33 13

in the Browser Tab title, you see "Paddy etc" when loading

Screen Shot 2021-09-27 at 14 54 56

we counterchecked and changed the Port to 9002 while the Proxy looks for 9001 and the site is gone - or comes back when reenabling 9001 as port - this means it is definitely serving the files shown in the "black" first screenshot and NOT the settings file shown in /admin/settings - all changes you perform there are more or less useless!

Screen Shot 2021-09-27 at 15 01 15

--

Screen Shot 2021-09-27 at 15 01 43

We also saw that in etherpad-lite/var lots of minified files get created despise the fact that minified is set to false and "0"

Screen Shot 2021-09-27 at 15 08 53

--

Screen Shot 2021-09-27 at 15 10 29

As it was an empty fresh etherpad installation

Screen Shot 2021-09-27 at 15 13 36

we installed eb_embedmedia from admin/plugins

Screen Shot 2021-09-27 at 15 14 35

but on all our machines (all Mac) the embedmedia icon did not show up nor did the button work at all (open up the modal window as it is supposed to)

Screen Shot 2021-09-27 at 15 15 45

Finally we tried it again with a completely empty new database - cleared again all caches, disabled Cloudflare but no changes

Screen Shot 2021-09-27 at 3 20 31 PM

- - -

Here is the admin/troubleshooting information

Etherpad version
Version number: 1.8.14

Latest available version: 1.8.14

Git sha: 4d28394

Installed plugins
ep_embedmedia
ep_etherpad-lite
Installed parts
ep_etherpad-lite/openapi
ep_etherpad-lite/adminsettings
ep_etherpad-lite/adminplugins
ep_etherpad-lite/admin
ep_etherpad-lite/tests
ep_etherpad-lite/socketio
ep_etherpad-lite/errorhandling
ep_etherpad-lite/importexport
ep_etherpad-lite/apicalls
ep_etherpad-lite/webaccess
ep_etherpad-lite/padurlsanitize
ep_etherpad-lite/specialpages
ep_etherpad-lite/i18n
ep_etherpad-lite/stats
ep_etherpad-lite/static
ep_etherpad-lite/express
ep_etherpad-lite/Minify
ep_etherpad-lite/DB
ep_embedmedia/embedmedia
Installed hooks
Server-side hooks
createServer:
ep_etherpad-lite:
express:
ep_etherpad-lite/node/hooks/express
eejsBlock_body:
ep_embedmedia:
embedmedia:
ep_embedmedia/hooks:eejsBlock_body
eejsBlock_editbarMenuLeft:
ep_embedmedia:
embedmedia:
ep_embedmedia/hooks:eejsBlock_editbarMenuLeft
eejsBlock_scripts:
ep_embedmedia:
embedmedia:
ep_embedmedia/hooks:eejsBlock_scripts
eejsBlock_styles:
ep_embedmedia:
embedmedia:
ep_embedmedia/hooks:eejsBlock_styles
expressCloseServer:
ep_etherpad-lite:
socketio:
ep_etherpad-lite/node/hooks/express/socketio
expressConfigure:
ep_etherpad-lite:
webaccess:
ep_etherpad-lite/node/hooks/express/webaccess
expressCreateServer:
ep_etherpad-lite:
admin:
ep_etherpad-lite/node/hooks/express/admin
adminplugins:
ep_etherpad-lite/node/hooks/express/adminplugins
adminsettings:
ep_etherpad-lite/node/hooks/express/adminsettings
apicalls:
ep_etherpad-lite/node/hooks/express/apicalls
errorhandling:
ep_etherpad-lite/node/hooks/express/errorhandling
i18n:
ep_etherpad-lite/node/hooks/i18n
importexport:
ep_etherpad-lite/node/hooks/express/importexport
openapi:
ep_etherpad-lite/node/hooks/express/openapi
padurlsanitize:
ep_etherpad-lite/node/hooks/express/padurlsanitize
socketio:
ep_etherpad-lite/node/hooks/express/socketio
specialpages:
ep_etherpad-lite/node/hooks/express/specialpages
static:
ep_etherpad-lite/node/hooks/express/static
tests:
ep_etherpad-lite/node/hooks/express/tests
restartServer:
ep_etherpad-lite:
express:
ep_etherpad-lite/node/hooks/express
shutdown:
ep_etherpad-lite:
DB:
ep_etherpad-lite/node/db/DB
express:
ep_etherpad-lite/node/hooks/express
Minify:
ep_etherpad-lite/node/utils/Minify
stats:
ep_etherpad-lite/node/stats
socketio:
ep_etherpad-lite:
adminplugins:
ep_etherpad-lite/node/hooks/express/adminplugins
adminsettings:
ep_etherpad-lite/node/hooks/express/adminsettings
socketio:
ep_etherpad-lite/node/handler/PadMessageHandler
Client-side hooks
aceAttribsToClasses:
ep_embedmedia:
embedmedia:
ep_embedmedia/static/js/hooks:aceAttribsToClasses
aceCreateDomLine:
ep_embedmedia:
embedmedia:
ep_embedmedia/static/js/hooks:aceCreateDomLine
aceInitInnerdocbodyHead:
ep_embedmedia:
embedmedia:
ep_embedmedia/static/js/hooks:aceInitInnerdocbodyHead

We tried the rewrite rules but were struggling to get them working for proxies to subfolders.
Our systemd/system/etherpad-lite.service

[Unit]
Description=Etherpad-lite, the collaborative editor.
After=syslog.target network.target

[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad/etherpad-lite
Environment=NODE_ENV=production

ExecStart=/usr/bin/node /opt/etherpad/etherpad-lite/src/node/server.js --settings /etc/etherpad/settings-lite.json --credentials /opt/etherpad/config/credentials-lite.json

Restart=always
RestartSec=5

SyslogIdentifier=etherpad
StandardOutput=syslog
StandardError=syslog

[Install]
WantedBy=multi-user.target

Our Apache Proxy Settings where on its root HumHub is running and in /pad/ the etherpad

<VirtualHost 12.34.56.78:80>

    SuexecUserGroup #1234 #1234
    ServerName our.domain
    ServerAlias www.our.domain

    DocumentRoot /home/our-user/public_html

    ErrorLog /var/log/virtualmin/our.domain_error_log
    CustomLog /var/log/virtualmin/our.domain_access_log combined

    ScriptAlias /cgi-bin/ /home/our-user/cgi-bin/

    DirectoryIndex index.html index.htm index.php index.php4 index.php5

    <Directory /home/our-user/public_html>
	    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
		allow from all
		AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
		Require all granted
    </Directory>

    <Directory /home/our-user/cgi-bin>
	    allow from all
	    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
		Require all granted
    </Directory>

	RewriteEngine on
	RemoveHandler .php
	RemoveHandler .php7.4
	RemoveHandler .php8.0

	<FilesMatch \.php$>
	    SetHandler proxy:fcgi://localhost:8009
	</FilesMatch>

	# Proxy Settings
	ProxyVia On
    ProxyRequests Off
    ProxyPreserveHost on

	RewriteEngine On

	# Etherpad lite

 	RewriteRule ^/pad$ /pad/ [R]

	ProxyPass /pad/ http://127.0.0.1:9001/ retry=0 timeout=30
	ProxyPassReverse /pad/ http://127.0.0.1:9001/

	<Location /socket.io>
		# This is needed to handle the websocket transport through the proxy, since
		# etherpad does not use a specific sub-folder, such as /ws/ to handle this kind of traffic.
		# Taken from https://github.com/ether/etherpad-lite/issues/2318#issuecomment-63548542
		# Thanks to beaugunderson for the semantics
		RewriteCond %{QUERY_STRING} transport=websocket    [NC]
		RewriteRule /pad/(.*) ws://127.0.0.1:9001/socket.io/$1 [P,L]
		ProxyPass http://127.0.0.1:9001/socket.io retry=0 timeout=30
		ProxyPassReverse http://127.0.0.1:9001/socket.io
	</Location>

	# Whiteboard

	RedirectMatch ^/wbo$ /wbo/
	RewriteCond %{HTTP:Connection} Upgrade [NC]
	RewriteCond %{HTTP:Upgrade} websocket [NC]
	RewriteRule /wbo/(.*) ws://127.0.0.1:5001/$1  [P,L]
	ProxyPass /wbo/ http://127.0.0.1:5001/
	ProxyPassReverse /wbo/ http://127.0.0.1:5001/

	<Proxy *>
    	Options FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
    </Proxy>

</VirtualHost>

<VirtualHost 12.34.56.78:443>

    SuexecUserGroup #1234 #1234
    ServerName our.domain
    ServerAlias www.our.domain

    DocumentRoot /home/our-user/public_html

    ErrorLog /var/log/virtualmin/our.domain_error_log
    CustomLog /var/log/virtualmin/our.domain_access_log combined

    ScriptAlias /cgi-bin/ /home/our-user/cgi-bin/

    DirectoryIndex index.html index.htm index.php index.php4 index.php5

    <Directory /home/our-user/public_html>
	    Options -Indexes +IncludesNOEXEC +SymLinksIfOwnerMatch
		allow from all
		AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
		Require all granted
    </Directory>

    <Directory /home/our-user/cgi-bin>
	    allow from all
	    AllowOverride All Options=ExecCGI,Includes,IncludesNOEXEC,Indexes,MultiViews,SymLinksIfOwnerMatch
		Require all granted
    </Directory>

	RewriteEngine on
	RemoveHandler .php
	RemoveHandler .php7.4
	RemoveHandler .php8.0

	<FilesMatch \.php$>
	    SetHandler proxy:fcgi://localhost:8009
	</FilesMatch>

	SSLEngine on
	SSLCertificateFile /home/our-user/ssl.cert
	SSLCertificateKeyFile /home/our-user/ssl.key
	SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
	SSLCACertificateFile /home/our-user/ssl.ca

	# Proxy Settings
	ProxyVia On
    ProxyRequests Off
    ProxyPreserveHost on

	RewriteEngine On

	# Etherpad lite

 	RewriteRule ^/pad$ /pad/ [R]

	ProxyPass /pad/ http://127.0.0.1:9001/ retry=0 timeout=30
	ProxyPassReverse /pad/ http://127.0.0.1:9001/

	#<Location /socket.io>
		# This is needed to handle the websocket transport through the proxy, since
		# etherpad does not use a specific sub-folder, such as /ws/ to handle this kind of traffic.
		# Taken from https://github.com/ether/etherpad-lite/issues/2318#issuecomment-63548542
		# Thanks to beaugunderson for the semantics
		RewriteCond %{QUERY_STRING} transport=websocket    [NC]
		RewriteRule /pad/(.*) ws://127.0.0.1:9001/socket.io/$1 [P,L]
		ProxyPass /pad/ http://127.0.0.1:9001/socket.io retry=0 timeout=30
		ProxyPassReverse /pad/ http://127.0.0.1:9001/socket.io
	#</Location>

	# Whiteboard

	RedirectMatch ^/wbo$ /wbo/
	RewriteCond %{HTTP:Connection} Upgrade [NC]
	RewriteCond %{HTTP:Upgrade} websocket [NC]
	RewriteRule /wbo/(.*) ws://127.0.0.1:5001/$1  [P,L]
	ProxyPass /wbo/ http://127.0.0.1:5001/
	ProxyPassReverse /wbo/ http://127.0.0.1:5001/

	<Proxy *>
    	Options FollowSymLinks MultiViews
		AllowOverride All
		Order allow,deny
		allow from all
    </Proxy>



</VirtualHost>

We tried the rewrite but it is producing a circle like pad/pad/pad/..... and when we take over from the tutorial - unmodified - it won't work

RewriteEngine On
RewriteRule /pad/p/*$ https://our.domain/pad/ [NC,L]
RewriteRule /p/*$ https://our.domain/pad/ [NC,L]
RewriteCond %{REQUEST_URI} !^/pad/locales/
RewriteCond %{REQUEST_URI} !^/pad/locales.json
RewriteCond %{REQUEST_URI} !^/pad/admin
RewriteCond %{REQUEST_URI} !^/pad/p/
RewriteCond %{REQUEST_URI} !^/pad/static/
RewriteCond %{REQUEST_URI} !^/pad/pluginfw/
RewriteCond %{REQUEST_URI} !^/pad/javascripts/
RewriteCond %{REQUEST_URI} !^/pad/socket.io/
RewriteCond %{REQUEST_URI} !^/pad/ep/
RewriteCond %{REQUEST_URI} !^/pad/minified/
RewriteCond %{REQUEST_URI} !^/pad/api/
RewriteCond %{REQUEST_URI} !^/pad/ro/
RewriteCond %{REQUEST_URI} !^/pad/error/
RewriteCond %{REQUEST_URI} !^/pad/jserror
RewriteCond %{REQUEST_URI} !^/pad/redirect
RewriteCond %{REQUEST_URI} !/pad/favicon.ico
RewriteCond %{REQUEST_URI} !/pad/robots.txt
RewriteRule ^/pad/+(.+)$ https://our.domain/pad/$1 [L]

Not sure what is wrong - sorry!

@lisandi
Copy link
Author

lisandi commented Sep 28, 2021

Working now by changing the absolute links to relative links

Unfortunately can't edit or fork that repository! perhaps you can enable that.
The following needs to get changed:

in ep_embedmedia/templates/styles.ejs change

<link rel="stylesheet" href="/static/plugins/ep_embedmedia/static/css/main.css" type="text/css" />

to

<link rel="stylesheet" href="../static/plugins/ep_embedmedia/static/css/main.css" type="text/css" />

and in ep_embedmedia/templates/scripts.ejs change

<script src="/static/plugins/ep_embedmedia/static/js/html4-defs.js"></script>
<script src="/static/plugins/ep_embedmedia/static/js/html-sanitizer.js"></script>
<script src="/static/plugins/ep_embedmedia/static/js/main.js"></script>

to

<script src="../static/plugins/ep_embedmedia/static/js/html4-defs.js"></script>
<script src="../static/plugins/ep_embedmedia/static/js/html-sanitizer.js"></script>
<script src="../static/plugins/ep_embedmedia/static/js/main.js"></script>

@rhansen rhansen changed the title TODO: describe this issue clicking button doesn't work Sep 28, 2021
@rhansen rhansen changed the title clicking button doesn't work clicking button doesn't work when Etherpad is served from a subdirectory Sep 28, 2021
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.

4 participants