Skip to content

Basic Auth via Apache Proxy: ethercalc --key always redirects to /edit instead of /view? #369

Open
@crubb

Description

@crubb

Hey guys,

I'm trying to set up basic auth according to #1 and #4. As soon as I provide a --key on the command line and go to one of my spreadsheets I always get automatically redirected to /edit instead of /view - Even when I delete all my browser's cache, restart apache and ethercalc. Did an npm update just today, but it already happened before the update.

Can you give me any hints?

Apache Config

<Directory "/home/ethercalc/node_modules/ethercalc/">
  Options FollowSymlinks
  AllowOverride None
  Require all granted
</Directory>

RewriteEngine On

# Proxy pass to the node.js server (port 8000)
ProxyPass /.well-known/ !
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/

# Set up websockets to work through the proxy
RewriteCond %{REQUEST_URI}  ^/socket.io            [NC]
RewriteCond %{QUERY_STRING} transport=websocket    [NC]
RewriteRule /(.*)           ws://localhost:8000/$1 [P,L]

<LocationMatch "^/">
  AuthType Basic
  AuthName "Ethercalc Viewer"
  AuthUserFile "/var/www/.../.htpasswd"
  Require valid-user
  Order allow,deny
  Allow from all
</LocationMatch>

<LocationMatch ^/(.*)/edit$>
  AuthType Basic
  AuthName "Ethercalc Viewer"
  AuthUserFile "/var/www/.../.htpasswd"
  Require user admin
  Order allow,deny
  Allow from all
</LocationMatch>

# For letsencrypt
<LocationMatch "^/.well-known/">
  AuthType None
  Require all granted
</LocationMatch>

# Set up an alias for static files. Saves having to serve them from node.js
Alias /static /home/ethercalc/node_modules/ethercalc/static
Alias /l10n /home/ethercalc/node_modules/ethercalc/l10n
Alias /images /home/ethercalc/node_modules/ethercalc/images

Command line

/home/ethercalc/node_modules/ethercalc/bin/ethercalc --host 127.0.0.1 --key ThisIsASecret57592

Any hints would be greatly appreciated.

Thank you!

Best regards,
crubb

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions