Skip to content
This repository has been archived by the owner on May 31, 2021. It is now read-only.

Changing BaseURI not working at all #755

Closed
3 tasks done
infernix opened this issue Jan 19, 2019 · 21 comments
Closed
3 tasks done

Changing BaseURI not working at all #755

infernix opened this issue Jan 19, 2019 · 21 comments
Labels

Comments

@infernix
Copy link

Type: Bug Report

  • Try to follow the update procedure described in the README and try again before opening this issue.
  • Please check the F.A.Q..
  • Please check the Troubleshooting wiki section.

Your Environment

  • Version used:
    2cd1aa6
  • Environment name and version:
    • Node.js version node --version
      v8.15.0
    • npm version npm --version
      6.4.1
    • Web browser name and version
      Chrome 71
  • Operating System and version:
    Debian 9

Summary

With baseURI set to '/' everything works. With any other value, every request is returning contents of / (e.g. "index.html").

Note the size of each returned request is identical:

GET /flood/ 200 6.865 ms - 567
GET /flood/static/css/main.b100a554.css 200 3.227 ms - 567
GET /flood/static/js/main.40e9b03a.js 200 2.379 ms - 567
GET /flood/favicon.ico 200 1.414 ms - 567
GET /flood/asdf 200 1.758 ms - 567
GET /flood/static/css/main.b100a554.css 200 2.166 ms - 567
GET /flood/static/js/main.40e9b03a.js 200 1.775 ms - 567
GET /flood/favicon.ico 200 1.141 ms - 567

Content of each response is:

<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><link rel="manifest" href="/flood/manifest.json"><link rel="shortcut icon" href="/flood/favicon.ico"><title>Flood</title><link href="/flood/static/css/main.b100a554.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="app"></div><script type="text/javascript" src="/flood/static/js/main.40e9b03a.js"></script></body></html>

Not using any reverse proxying here. And again, when leaving baseURI as '/' everything works.

Expected Behavior

baseURI changes should work.

Current Behavior

Not working at all

Possible Solution

No idea :|

Steps to Reproduce

  1. change baseURI to anything other than /
  2. npm install, npm build, npm start
  3. open flood directly
  4. not working

Context

make it work

@noraj
Copy link
Contributor

noraj commented Jan 22, 2019

maybe related to #621

@noraj noraj added the bug label Jan 22, 2019
@fsamareanu
Copy link

fsamareanu commented Jan 28, 2019

Hello,

After the change in config.js have you ran npm run build ? Also, make sure there's a trailing / into URI:

baseURI: '/flood/',

Also, if you're running a reverse proxy in front of flood make sure there's a trailing / there as well, for example (nginx):

        location /flood/ {
                proxy_pass http://127.0.0.1:3000/;
        }

@infernix
Copy link
Author

Yes, i reran npm build. Trailing slash doesn't matter, if you look at the code it adds one if missing.

Problem occurs when accessing directly so reverse proxy config isn't relevant (yet).

@fsamareanu
Copy link

fsamareanu commented Jan 28, 2019

I've tried on the latest master this a few times and every time it worked. Sequence of events:

  1. systemctl stop flood
  2. npm install
  3. npm run build
  4. chown -R flood:flood /opt/flood/
  5. systemctl start flood

Every time the change of baseURI worked (I disabled cache while keeping open developer tools in order to avoid surprises).

EDIT: there's a difference between npm build and npm run build. Make sure you don't make that mistake, as silly as it looks.

@infernix
Copy link
Author

infernix commented Jan 28, 2019

https://asciinema.org/a/k1yfS6uqN0tXuM1tesR0iZwGV

As i said, it doesn't work as described. Question is why?

Edit: Gif for the lazy

@itzwam
Copy link

itzwam commented Jan 28, 2019

You're not doing it well, baseURI is not modifying the return of pages, it's changing the import location

@infernix
Copy link
Author

what exactly am I supposed to do then? If you look carefully, every URL that I curl is returning the same exact content. Including the URLs it's referencing, e.g. /flood/mainfest.json.

@fsamareanu
Copy link

fsamareanu commented Jan 30, 2019

I have tried again and still cannot reproduce.

root@seedbox /opt # git clone https://github.com/jfurrow/flood flood
Cloning into 'flood'...
remote: Enumerating objects: 16, done.
remote: Counting objects: 100% (16/16), done.
remote: Compressing objects: 100% (15/15), done.
remote: Total 12732 (delta 5), reused 3 (delta 1), pack-reused 12716
Receiving objects: 100% (12732/12732), 22.23 MiB | 19.92 MiB/s, done.
Resolving deltas: 100% (8312/8312), done.
root@seedbox /opt # cd flood
root@seedbox /opt/flood # cp /tmp/q/config.js . -i
root@seedbox /opt/flood # npm i

> [email protected] install /opt/flood/node_modules/argon2
> node-gyp rebuild

make: Entering directory '/opt/flood/node_modules/argon2/build'
  CC(target) Release/obj.target/libargon2/argon2/src/opt.o
  CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
  CC(target) Release/obj.target/libargon2/argon2/src/core.o
  CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
  CC(target) Release/obj.target/libargon2/argon2/src/thread.o
  CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
  AR(target) Release/obj.target/argon2.a
  COPY Release/argon2.a
  CXX(target) Release/obj.target/argon2/src/argon2_node.o
  SOLINK_MODULE(target) Release/obj.target/argon2.node
  COPY Release/argon2.node
make: Leaving directory '/opt/flood/node_modules/argon2/build'

> [email protected] install /opt/flood/node_modules/node-sass
> node scripts/install.js

Cached binary found at /root/.npm/node-sass/4.10.0/linux-x64-57_binding.node

> [email protected] postinstall /opt/flood/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


> [email protected] postinstall /opt/flood/node_modules/node-sass
> node scripts/build.js

Binary found at /opt/flood/node_modules/node-sass/vendor/linux-x64-57/binding.node
Testing binary
Binary is fine

> [email protected] postinstall /opt/flood/node_modules/nodemon
> node bin/postinstall || exit 0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1781 packages from 962 contributors and audited 37086 packages in 72.715s
found 1 high severity vulnerability
  run `npm audit fix` to fix them, or `npm audit` for details
root@seedbox /opt/flood # npm run build

> [email protected] build /opt/flood
> node client/scripts/build.js

Creating an optimized production build...
DEPRECATION WARNING on line 1, column 8 of stdin:
Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.
Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.


DEPRECATION WARNING on line 1, column 8 of stdin:
Including .css files with @import is non-standard behaviour which will be removed in future versions of LibSass.
Use a custom importer to maintain this behaviour. Check your implementations documentation on how to create a custom importer.

Compiled successfully.

File sizes after gzip:

  405.32 KB  assets/static/js/main.3109b8c3.js
  16.3 KB    assets/static/css/main.b100a554.css


   ╭───────────────────────────────────────────────────────────────╮
   │                                                               │
   │       New minor version of npm available! 6.4.1 → 6.7.0       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.7.0   │
   │               Run npm install -g npm to update!               │
   │                                                               │
   ╰───────────────────────────────────────────────────────────────╯

root@seedbox /opt/flood # grep baseURI config.js
  // Recompiling assets with `npm run build` is needed after each `baseURI` change.
  baseURI: '/flood',
root@seedbox /opt/flood # chown -R flood:flood ../flood
root@seedbox /opt/flood # systemctl restart flood
root@seedbox /opt/flood #

And I can connect to flood just fine using the browser.

EDIT: I may have reproduced something similar. It ONLY happens if you access flood on localhost. For example, if you port forward 3000 to your local machine on port 3000 then the GUI doesn't load in Chrome. However, if, like I did, you access something like https://ip/flood (I have an nginx server in front) then the UI loads.

@infernix
Copy link
Author

Aha. So with a reverse proxy which sends all requests to flood from localhost it will also happen then.

Nice find. I'll try to confirm this when i have some free time

@fsamareanu
Copy link

No, for me (TM) the UI loads when accessed through nginx (I have something like me->cloudflare (let's say seedbox.domain.com) ->nginx with CF edge certificate-> /flood mapped in nginx to 127.0.0.1:3000).

What works: https://seedbox.domain.com/flood in Chrome
What doesn't work: port forward 3000 using ssh and http://localhost:3000 on my laptop in Chrome

@infernix
Copy link
Author

infernix commented Feb 1, 2019

Well, this doesn't work for me even when I pass it an actual hostname. Everything works fine with baseURI: '/' and a npm run build, but anything else as baseURI just doesn't work correctly at all. 🤷‍♂️

@fsamareanu
Copy link

Just out of curiosity, are you trying from a browser?

@infernix
Copy link
Author

infernix commented Feb 1, 2019

Yes, same results with chrome and curl.

@NoLooseEnds
Copy link

I think issue 761 is related to this. Seems to happen when you use a reverse proxy (traefik) in my case and change the baseURI.

@jfurrow
Copy link
Member

jfurrow commented Apr 25, 2019

This is consistently a problem for people, so somehow we need to do a better job educating users.

In all of these cases, it is a misconfiguration of the proxy — this is not an issue with Flood. The feature is working as expected. Please read this documentation in the wiki.

@jfurrow jfurrow closed this as completed Apr 25, 2019
@infernix
Copy link
Author

@jfurrow in my comment above, I'm using curl directly against Flood and it is not working as expected. How is it a misconfiguration of the proxy then?

@Whisper40
Copy link

Whisper40 commented Apr 25, 2019

@infernix @jfurrow I confirm too that BaseURI is not working at all. A lot of test has been made, without good results. It only works with / or with subdomain in / .

@jfurrow
Copy link
Member

jfurrow commented Apr 27, 2019

@infernix It's because you're expecting behavior that the feature doesn't do. Read the documentation.

@billimek
Copy link

billimek commented Jun 2, 2019

Has anyone successfully found a traefik configuration that will work with flood? Using traefik for about 30 other applications and don't experience this type of behavior.

I have no problem hitting flood directly but when proxying via traefik, it experiences the issue with not rending anything after the initial flood login screen. This is with the default / path and no custom subdomain.

@jfurrow
Copy link
Member

jfurrow commented Jun 2, 2019

@billimek That's a common issue seen by folks who aren't properly forwarding all of the requests (all API endpoints and static assets) to the Flood server, or haven't re-built their static assets after configuring the baseURI option.

@billimek
Copy link

billimek commented Jun 2, 2019

Using the same traefik configuration doesn't exhibit this behavior with an older version of the Flood that's baked into the docker image wonderfall/rtorrent-flood:0.9.7-0.13.7, but it looks like that was built a year ago so not sure what changes in flood to look through to understand what changed that causes this new behavior.

Hopefully someone here in this issue or the other issue has found a way to work around this and can post whatever special traefik configuration is necessary to make it work!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

8 participants