oneclickdapp / oneclickdapp-v1

:zap::wrench::link: :shipit: Instantly build a dApp with a simple URL to bookmark or share with a friend.
http://OneClickdApp.com
MIT License
254 stars 69 forks source link

Production build on Digital Ocean server "Cannot GET /~deliver-europe-chance" #24

Closed pi0neerpat closed 6 years ago

pi0neerpat commented 6 years ago

Digital Ocean droplet 1 GB Memory / 25 GB Disk / NYC1 - Ubuntu 18.04 x64 / node v8.10.0

The root path "/" works fine, however when trying to navigate to a dapp "Cannot GET /~deliver-europe-chance" (using any mnemonic).

On firefox I get the following warning: Content Security Policy: The page’s settings blocked the loading of a resource at self (“default-src”). Source: !function(){return function t(e,r,n){fun.... On Chrome I don't get any warning.

NOTE: No issues when running locally, only when using the Digital Ocean server.

To achieve the same result-clone the branch productionBuild. Then npm run start-production to create a production build of the app and starts server.js in production mode.

pi0neerpat commented 6 years ago

The client folder is in the same folder as server.js, so I don't think this is the issue: https://stackoverflow.com/questions/46509186/how-to-correct-issue-with-nodejs-with-react-app-not-loading-content-properly-rel

pi0neerpat commented 6 years ago

I believe the issue is that I need to ensure that all the routes go to the same place i.e. send them to the main page. Currently app.use(["/" , "/~*"], express.static("client/build")) is trying to send the user to a file in client/build/~<mnemonic> which doesn't exist