lewish / asciiflow

ASCIIFlow
https://asciiflow.com
MIT License
4.64k stars 357 forks source link

Allow access from external machines #221

Closed Gvllvgher closed 2 years ago

Gvllvgher commented 2 years ago

I wanted to create an image of this application to use in with Docker. Due to node listening on 127.0.0.1; you cannot access the web UI from external machines.

I've added two lines to webpack.config.js that allow external machines to access the UI running on port 9110. These lines configure node to listen on 0.0.0.0 instead of 127.0.0.1 and disables host checking (for use behind reverse proxy).

This may be better as an option/argument/flag that can be used with bazel run client:devserver so that it's not the default setting, but I don't know if that's possible. Something like --production that would set these values so the app listens on 0.0.0.0.

This is my first PR, so please respond with any feedback/comments/recommendations.

lewish commented 2 years ago

OK so my first thought is that you don't want to do this :) This target is called devserver for a reason! It's serving unoptimized JS, it live reloads, and I can't make any claims about how secure it is (it's webpack-devserver under the hood). Given that - I wouldn't personally serve this to other users, and I think that also means avoiding allowing non-local connections by default.

Take a look at the GitHub Action that builds asciiflow.com - https://github.com/lewish/asciiflow/blob/master/.github/workflows/deploy.yaml

Asciiflow is a 100% static site, once you build it properly with bazel build site/..., it exists in the folder bazel-bin/site - you can copy those files anywhere and serve them with e.g nginx or any other static site serving tool (asciiflow.com just runs on GitHub Pages).

Gvllvgher commented 2 years ago

Hey! Thank you for the response!

This makes a lot of sense, and I really appreciate the clarification. I'm going to go try building the right way!

Closing this PR.