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

initial page immediately replaced by empty root div? #1144

Closed
laurencefass opened this issue Oct 28, 2019 · 62 comments
Closed

initial page immediately replaced by empty root div? #1144

laurencefass opened this issue Oct 28, 2019 · 62 comments

Comments

@laurencefass
Copy link

laurencefass commented Oct 28, 2019

I have configured nginx reverse proxy to redirect 3000 and 3001 for default create-razzle-app. The page loads but is immediately replaced with empty root div.

.env file

HOST='apps.syntapse.co.uk'
PORT=3000
VERBOSE='true'
NODE_ENV='development'
BUILD_TARGET='client'
PUBLIC_PATH='https://apps.syntapse.co.uk/razzle'
CLIENT_PUBLIC_PATH='https://apps.syntapse.co.uk/razzle-dev'

nginx server definition for the redirects:

server {
      listen 80;
      server_name apps.syntapse.co.uk;
      location ^~ /razzle-dev {
         proxy_pass http://0.0.0.0:3001/;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_cache_bypass $http_upgrade;
      }    	
      location ^~ /razzle {
         proxy_pass http://0.0.0.0:3000/;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_cache_bypass $http_upgrade;
      }    	
 }
@laurencefass
Copy link
Author

Also seeing following errors in console:


Warning: Please use `require("react-router-dom").Route` instead of `require("react-router-dom/Route")`. Support for the latter will be removed in the next major release.
console.<computed> @ index.js:1
printWarning @ warnAboutDeprecatedCJSRequire.js:17
./node_modules/react-router-dom/warnAboutDeprecatedCJSRequire.js.module.exports @ warnAboutDeprecatedCJSRequire.js:30
./node_modules/react-router-dom/Route.js @ Route.js:2
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
./src/App.js @ App.css?cfc9:45
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
./src/client.js @ Home.js:33
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
index.js:1 Warning: Please use `require("react-router-dom").Switch` instead of `require("react-router-dom/Switch")`. Support for the latter will be removed in the next major release.
console.<computed> @ index.js:1
printWarning @ warnAboutDeprecatedCJSRequire.js:17
./node_modules/react-router-dom/warnAboutDeprecatedCJSRequire.js.module.exports @ warnAboutDeprecatedCJSRequire.js:30
./node_modules/react-router-dom/Switch.js @ Switch.js:2
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
./src/App.js @ App.css?cfc9:45
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
./src/client.js @ Home.js:33
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
index.js:1 Warning: Please use `require("react-router-dom").BrowserRouter` instead of `require("react-router-dom/BrowserRouter")`. Support for the latter will be removed in the next major release.
console.<computed> @ index.js:1
printWarning @ warnAboutDeprecatedCJSRequire.js:17
./node_modules/react-router-dom/warnAboutDeprecatedCJSRequire.js.module.exports @ warnAboutDeprecatedCJSRequire.js:30
./node_modules/react-router-dom/BrowserRouter.js @ BrowserRouter.js:2
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
./src/client.js @ Home.js:33
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
index.js:1 Warning: Did not expect server HTML to contain a <div> in <div>.
console.<computed> @ index.js:1
warningWithoutStack @ react-dom.development.js:530
warnForDeletedHydratableElement @ react-dom.development.js:8523
didNotHydrateContainerInstance @ react-dom.development.js:9838
deleteHydratableInstance @ react-dom.development.js:17676
popHydrationState @ react-dom.development.js:18012
completeWork @ react-dom.development.js:20976
completeUnitOfWork @ react-dom.development.js:24700
performUnitOfWork @ react-dom.development.js:24673
workLoopSync @ react-dom.development.js:24638
performSyncWorkOnRoot @ react-dom.development.js:24237
scheduleUpdateOnFiber @ react-dom.development.js:23665
updateContainer @ react-dom.development.js:27061
(anonymous) @ react-dom.development.js:27485
unbatchedUpdates @ react-dom.development.js:24400
legacyRenderSubtreeIntoContainer @ react-dom.development.js:27484
hydrate @ react-dom.development.js:27559
./src/client.js @ client.js:6
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
sockjs.js:1606 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298947474 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
client:172 [WDS] Disconnected!
close @ client:172
(anonymous) @ socket.js:26
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
abstract-xhr.js:132 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298947521 net::ERR_SSL_PROTOCOL_ERROR
./node_modules/razzle-dev-utils/node_modules/sockjs-client/lib/transport/browser/abstract-xhr.js.AbstractXHRObject._start @ abstract-xhr.js:132
(anonymous) @ abstract-xhr.js:21
setTimeout (async)
AbstractXHRObject @ abstract-xhr.js:20
XHRCorsObject @ xhr-cors.js:8
InfoAjax @ info-ajax.js:19
./node_modules/razzle-dev-utils/node_modules/sockjs-client/lib/info-receiver.js.InfoReceiver._getReceiver @ info-receiver.js:39
./node_modules/razzle-dev-utils/node_modules/sockjs-client/lib/info-receiver.js.InfoReceiver.doXhr @ info-receiver.js:56
(anonymous) @ info-receiver.js:25
setTimeout (async)
InfoReceiver @ info-receiver.js:24
SockJS @ main.js:121
(anonymous) @ webpackHotDevClient.js:61
./node_modules/razzle-dev-utils/webpackHotDevClient.js @ webpackHotDevClient.js:274
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
webpackHotDevClient.js:76 The development server has disconnected.
Refresh the page if necessary.
sockjs.js:1606 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298948698 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
sockjs.js:1606 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298950908 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
sockjs.js:1606 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298955053 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
sockjs.js:1606 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298963215 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) @ bootstrap:793
sockjs.js:1606 GET https://apps.syntapse.co.uk:3001/sockjs-node/info?t=1572298979315 net::ERR_SSL_PROTOCOL_ERROR
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ socket.js:39
setTimeout (async)
(anonymous) @ socket.js:38
EventTarget.dispatchEvent @ sockjs.js:170
(anonymous) @ sockjs.js:970
setTimeout (async)
SockJS._close @ sockjs.js:958
SockJS._receiveInfo @ sockjs.js:787
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:567
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
(anonymous) @ sockjs.js:374
g @ sockjs.js:66
EventEmitter.emit @ sockjs.js:86
xhr.onreadystatechange @ sockjs.js:1598
XMLHttpRequest.send (async)
AbstractXHRObject._start @ sockjs.js:1606
(anonymous) @ sockjs.js:1495
setTimeout (async)
AbstractXHRObject @ sockjs.js:1494
XHRCorsObject @ sockjs.js:2872
InfoAjax @ sockjs.js:356
InfoReceiver._getReceiver @ sockjs.js:539
InfoReceiver.doXhr @ sockjs.js:556
(anonymous) @ sockjs.js:525
setTimeout (async)
InfoReceiver @ sockjs.js:524
SockJS @ sockjs.js:731
SockJSClient @ SockJSClient.js:39
initSocket @ socket.js:20
(anonymous) @ client:176
./node_modules/webpack-dev-server/client/index.js?http://apps.syntapse.co.uk:3001 @ client:176
__webpack_require__ @ bootstrap:726
fn @ bootstrap:100
1 @ react.svg:1
__webpack_require__ @ bootstrap:726
(anonymous) @ bootstrap:793
(anonymous) 
```@ bootstrap:793

@fivethreeo
Copy link
Collaborator

Did you forget to set config.devServer.public to 'apps.syntapse.co.uk:443' in razzle.config.js? 😀

@fivethreeo
Copy link
Collaborator

Any CORS warnings? I'll do a razzle-plugin-proxy npm module when I wake up sometime later today.

@laurencefass
Copy link
Author

laurencefass commented Oct 29, 2019

There are no CORS warnings. I changed my original configuration due to persistent CORS errors

Now public and client paths are on the same domain as defined in .env file:

PUBLIC_PATH='https://apps.syntapse.co.uk/razzle'
CLIENT_PUBLIC_PATH='https://apps.syntapse.co.uk/razzle-dev'

result = no output at all after initial page load.

I'm not sure if 'apps.syntapse.co.uk:443' is correct in my context I have set razzle.config.js=> devserver.public to match CLIENT_PUBLIC_PATH and my nginx routing.

// razzle.config.js
'use strict';

module.exports = {
  modify: (defaultConfig, { target, dev }, webpack) => {
        const config = defaultConfig;

        if (target === 'web' && dev) {
            config.devServer.public = 'https://apps.syntapse.co.uk/razzle-dev';
        }
        return config;
    }
}

@laurencefass
Copy link
Author

laurencefass commented Oct 29, 2019

I will leave https://apps.syntapse.co.uk/razzle running. debugger shows that bundle.js and svg but the client is over-writing the output with a blank screen and throwing lots of repeated sock.js errors.

Request URL: https://apps.syntapse.co.uk/sockjs-node/info?t=1572338501760
Request Method: GET
Status Code: 404 
Remote Address: 51.38.71.147:443
Referrer Policy: no-referrer-when-downgrade

The sockjs-node path looks wrong and https://apps.syntapse.co.uk/sockjs-node/info?t=1572338501760 returns a 404.

@fivethreeo
Copy link
Collaborator

https://www.npmjs.com/package/razzle-plugin-proxy easier to set up. But your proxy is down...

@fivethreeo
Copy link
Collaborator

sockjs-node path is hard coded in sockjs-node so it wont do well on a subpath.

@laurencefass
Copy link
Author

thanks what does the razzle plugin proxy do? im trying to avoid adding more complexity to work out why the basic create-razzle-app doesnt work.

@laurencefass
Copy link
Author

"sockjs-node path is hard coded in sockjs-node so it wont do well on a subpath".

Does that mean i can't use create-razzle-app behind a proxy? I think this may be a WDS error as Ive seen lots of very similar reports for other frameworks and libraries.

@fivethreeo
Copy link
Collaborator

Fixes port in so https://github.com/jaredpalmer/razzle/blob/master/packages/razzle-dev-utils/webpackHotDevClient.js#L65 points to the port or non port in CLIENT_PUBLIC_PATH='https://apps.syntapse.co.uk/razzle-dev' but I could add in fixing sockjs..

@laurencefass
Copy link
Author

Thanks again for your help. Razzle is by far the most difficult React based app i've tried to run. I'm testing alongside hot reload dev versions of next, vue, nuxt, CRA, angular on the same server all ran first time behind the reverse proxy.

@laurencefass
Copy link
Author

server is running again at

https://apps.syntapse.co.uk/razzle/

client making repeated calls to https://apps.syntapse.co.uk:4001/sockjs-node/...

@laurencefass
Copy link
Author

I dont have a UI or browser for my server and two levels of reverse proxy so I think I'm going to have to use URLs to address them from the browser. It was working ok(ish) using two separate domains for server and client bundles but then i had CORS issues. Ideally I would like to have to paths on the same domain for my app. e.g.

domain.com/razzle (3000)
domain.com/razzle-dev (3001)

Is this achievable with Razzle or am I going to need localhost and browser on same machine?

@fivethreeo
Copy link
Collaborator

Fixed sockjs.node issue in razzle-plugin-proxy now :) so just use the plugin.

@laurencefass
Copy link
Author

"Set CLIENT_PUBLIC_PATH=https://www.example.com/webpack and proxy port 3001 to the backend".

(After installing plugin and adding to config.js) do I alter my .env CLIENT_PUBLIC_PATH

from

https://apps.syntapse.co.uk/razzle-dev
to

https://apps.syntapse.co.uk/webpack

and restart

@laurencefass
Copy link
Author

I still dont really understand if my problem is one of configuration or a bug with Razzle? Am I experiencing problems trying to proxy from .../paths to route to 3000 and 3001?

@fivethreeo
Copy link
Collaborator

yes :) razzle bug

@fivethreeo
Copy link
Collaborator

#1143

@laurencefass
Copy link
Author

sorry missed a question by adding another one: You said: "Set CLIENT_PUBLIC_PATH=https://www.example.com/webpack and proxy port 3001 to the backend".

to confirm my next steps....

(After installing plugin and adding to config.js) do I alter my .env CLIENT_PUBLIC_PATH

from

https://apps.syntapse.co.uk/razzle-dev

to

https://apps.syntapse.co.uk/webpack

and add location to server

      location ^~ /webpack {
         proxy_pass http://0.0.0.0:3001/;
         proxy_http_version 1.1;
         proxy_set_header Upgrade $http_upgrade;
         proxy_set_header Connection 'upgrade';
         proxy_set_header Host $host;
         proxy_cache_bypass $http_upgrade;
      }  

is that it?

thanks

@laurencefass
Copy link
Author

what effect will this have on the https://apps.syntapse.co.uk/sockjs-node/... URL?

@fivethreeo
Copy link
Collaborator

@fivethreeo
Copy link
Collaborator

Any client public path will work now if it is proxied :)

@laurencefass
Copy link
Author

laurencefass commented Oct 29, 2019

ive installed the plugin but the path remains as before https://apps.syntapse.co.uk/sockjs-node and still the cause of errors resulting in a white screen after page content is (briefly) loaded.

bash-4.4# npm list --depth 0
my-razzle-app@0.1.0 /app/razzle/razzle
+-- express@4.17.1
+-- razzle@3.0.0
+-- razzle-plugin-proxy@1.0.7
+-- react@16.11.0
+-- react-dom@16.11.0
`-- react-router-dom@5.1.2

These are the ONLY changes I have made to the default create-razzle-app.

.env file

HOST='apps.syntapse.co.uk'
PORT=3000
VERBOSE='true'
NODE_ENV='development'
BUILD_TARGET='server'
PUBLIC_PATH='https://apps.syntapse.co.uk/razzle/'
CLIENT_PUBLIC_PATH='https://apps.syntapse.co.uk/razzle-wds/'

razzle.config.js

module.exports = {
    plugins: ['proxy'],
};

nginx redirects:

server {
    listen 80;
    server_name apps.syntapse.co.uk;
    location  ^~ /razzle-wds {
        proxy_pass http://0.0.0.0:3001/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }    	
    location  ^~ /razzle {
        proxy_pass http://0.0.0.0:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }    	
 }

to confirm:
https://apps.syntapse.co.uk/sockjs-node/ has not become https://apps.syntapse.co.uk/razzle-wds/sockjs-node/ as expected.

@laurencefass
Copy link
Author

laurencefass commented Oct 29, 2019

Am I correct to assume Razzle development server has only been designed/tested to work with localhost:port and localhost:port+1?

Will the plugin functionality be included in the main Razzle release? Its been a lot of trial-and-error to get to this point it would be great if it worked behind a proxy out-of-the-box.

@fivethreeo
Copy link
Collaborator

don't set
NODE_ENV='development'
BUILD_TARGET='server'

@fivethreeo
Copy link
Collaborator

razzle buillds both in dev

@laurencefass
Copy link
Author

ive removed

new env file:

HOST='apps.syntapse.co.uk'
PORT=3000
VERBOSE='true'
PUBLIC_PATH='https://apps.syntapse.co.uk/razzle/'
CLIENT_PUBLIC_PATH='https://apps.syntapse.co.uk/razzle-wds/'

restarted server. same problem persists.

@laurencefass
Copy link
Author

laurencefass commented Oct 29, 2019

ill leave the site running until tomorrow. its defintiely loading the bundle and the image correctly. something is overwriting the entire page with an empty div....

@fivethreeo
Copy link
Collaborator

pathname: '/webpack/sockjs-node',

CLIENT_PUBLIC_PATH='https://apps.syntapse.co.uk/razzle-wds/' ?, env must be wring

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

version: razzle-plugin-proxy@1.0.7

Results for running prod:

Visually I am experiencing the same issue (rendered content loads briefly followed by a white screen and empty root div). Something is definitely overwriting content.

jss and cs bundles load with 200 but the svg is a 404.

looks like this may be related to the socket issue. the url path looks wrong. is it missing /razzle/ prefix?

Request URL: https://apps.syntapse.co.uk/static/media/react.9a28da9f.svg = 404

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

re: prod

The svg file is available at https://apps.syntapse.co.uk**/razzle/**static/media/react.9a28da9f.svg but the page is requesting https://apps.syntapse.co.uk/static/media/react.9a28da9f.svg and omits /razzle/

Could solving this also solve issue with https://apps.syntapse.co.uk/sockjs-node/... also missing a /razzle-dev/webpack/ prefix?

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

for sake of clarity issue summary at this stage:

for both prod and dev after initial content load page loads blank with empty root div. there are problems with URLs

in prod:

css and js bundles load ok.
svg doesnt load.
svg URL is missing /razzle/ prefix

in dev

all bundle.js file loads ok.
sockjs_node URL is missing /razzle-dev/webpack/ prefix

@fivethreeo
Copy link
Collaborator

In prod you might have built with wrong PUBLIC_URL, in dev the plugin is not loaded somehow. Post your razzle.config.js

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

razzle.config.js

module.exports = {
    plugins: ['proxy'],
};

.env file (uncommenting as appropriate)

# dev mode
# PUBLIC_PATH=https://apps.syntapse.co.uk/razzle-dev/
# CLIENT_PUBLIC_PATH=https://apps.syntapse.co.uk/razzle-dev/webpack/
# PORT=3000

# production mode (run with start:prod)
# PUBLIC_PATH=https://apps.syntapse.co.uk/razzle/
# PORT=3002

these are the ONLY changes made to the default output of create-razzle-app

the nginx config is identical to #1144 (comment) with changed prod port to 3002 (and changed in the .env file)

the results in #1144 (comment) are reproducible on each run.

thanks

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

there are errors generated on the dev server client page.

console log

image

network errors

image

The first response is to the correct URL including /razzle-dev/webpack/ prefix.

Failed to load resource: the server responded with a status of 404 ()
webpackHotDevClient.js:76
The development server has disconnected.
Refresh the page if necessary.

subsequent calls drop the /razzle-dev/webpack prefix...

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

further discoveries:

re: prod. If I remove the /razzle/ prefix the page and all its assets loads correctly. It seems that my use of URL paths are breaking things. Is this by design or should domain.com/sub-paths resolve correctly?

re:dev

This same approach doesnt work for dev because if i remove /razzle-dev/ i still have a /webpack/ path included to redirect to 3001 which breaks Razzle.

I've also tried removing url paths entirely with .env

PUBLIC_PATH=https://apps.syntapse.co.uk/
CLIENT_PUBLIC_PATH=https://apps.syntapse.co.uk:3001/
PORT=3000

but this breaks too due to SSL_PROTOCOL_ERRORS which was the first problem I encountered before I tried to use url paths as a workaround.

image

Im not really sure if Razzle is designed to work with paths and this is a real bug or if I am trying to use it in ways its not designed for. I don't think the tests are exhaustive enough it would be great to see a few more tests included in the default create-razzle-app.

@laurencefass
Copy link
Author

quick update: this works ok! includes HMR working, but there are lots of errors see image at end of comment.

.env

PUBLIC_PATH=https://apps.syntapse.co.uk/
CLIENT_PUBLIC_PATH=https://apps.syntapse.co.uk/webpack
PORT=3000

and nginx

server {
    listen 80;
    server_name apps.syntapse.co.uk;
    location / {
        # prod or dev no path
        proxy_pass http://0.0.0.0:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }  
    location  ^~ /webpack {
        # dev webpack
        proxy_pass http://0.0.0.0:3001/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }  
}

image

@laurencefass
Copy link
Author

because of present limitations on use of domain/app format i cant hang multiple apps off a single domain which would be very useful but I've enough to work with for demos and testing.

@fivethreeo
Copy link
Collaborator

Maybe.. like this. But not quite sure :)

server {
    listen 80;
    server_name apps.syntapse.co.uk;
    location  ^~ /razzle-dev/webpack {
        proxy_pass http://0.0.0.0:3001/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }
    location  ^~ /razzle-dev/webpack/sockjs-node {
        proxy_pass http://0.0.0.0:3001/sockjs-node/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }         
      	
    location  ^~ /razzle-dev {
        proxy_pass http://0.0.0.0:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }    	

    location  ^~ /razzle {
        proxy_pass http://0.0.0.0:8080/;
        # use production port here
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }  
}

@fivethreeo
Copy link
Collaborator

OO, found a new devserver option sockPath :)

@fivethreeo
Copy link
Collaborator

So, new version of the plugin up now. Should handle the paths correctly now.

@laurencefass
Copy link
Author

laurencefass commented Oct 30, 2019

for clarity please can you summarise what the plugin does?

is it specific use to enable multiple apps to hang off one domain using domain.com/app format like the approach i have been trying to take?

@fivethreeo
Copy link
Collaborator

Yes that is the specific use. :)

@fivethreeo
Copy link
Collaborator

It parses CLIENT_PUBLIC_PATH and sets webpack.devServer options

  • public to host:port
  • sockPath to pathname portion of CLIENT_PUBLIC_PATH + 'sockjs-node'
  • replaces port and pathname in razzle-dev-utils/webpackHotDevClient.js for sockjs to match sockPath , and port for ErrorOverlay.

@laurencefass
Copy link
Author

Brilliant is this published elsewhere on npm or in documentation? Apologies if i have missed it already.

@laurencefass
Copy link
Author

laurencefass commented Oct 31, 2019

ive updated latest proxy plugin and after update im getting lots of dependency errors. I had to manually install express.

before installation

my-razzle-app@0.1.0 /app/razzle/razzle-proxy
+-- express@4.17.1
+-- razzle@3.0.0
+-- react@16.11.0
+-- react-dom@16.11.0
`-- react-router-dom@5.1.2

npm ERR! extraneous: babel-core@7.0.0-bridge.0 /app/razzle/razzle-proxy/node_modules/babel-jest/node_modules/babel-core

installation and errors

bash-4.4# npm install razzle-plugin-proxy --save
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated kleur@2.0.2: Please upgrade to kleur@3 or migrate to 'ansi-colors' if you prefer the old syntax. Visit <https://github.cs).
npm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/jest as it wasn't installed by /app/razzle/razzle-proxy/node_modules/jesnpm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/semver as it wasn't installed by /app/razzle/razzle-proxy/node_modules/snpm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/regjsparser as it wasn't installed by /app/razzle/razzle-proxy/node_modunpm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/json5 as it wasn't installed by /app/razzle/razzle-proxy/node_modules/jsnpm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/jsesc as it wasn't installed by /app/razzle/razzle-proxy/node_modules/jsnpm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/esparse as it wasn't installed by /app/razzle/razzle-proxy/node_modules/npm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/esvalidate as it wasn't installed by /app/razzle/razzle-proxy/node_modulnpm WARN rm not removing /app/razzle/razzle-proxy/node_modules/.bin/cssesc as it wasn't installed by /app/razzle/razzle-proxy/node_modules/c
> core-js@2.6.10 postinstall /app/razzle/razzle-proxy/node_modules/core-js
> node postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN my-razzle-app@0.1.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"
+ razzle-plugin-proxy@1.1.0
added 385 packages from 86 contributors, removed 109 packages, updated 1222 packages and audited 33073 packages in 134.73s
found 64 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
bash-4.4# npm ls --depth 0
my-razzle-app@0.1.0 /app/razzle/razzle-proxy
+-- UNMET DEPENDENCY express@^4.17.1
+-- razzle@3.0.0
+-- razzle-plugin-proxy@1.1.0
+-- react@16.11.0
+-- react-dom@16.11.0
`-- react-router-dom@5.1.2

npm ERR! missing: express@^4.17.1, required by my-razzle-app@0.1.0
npm ERR! missing: mkdirp@0.5.1, required by node-pre-gyp@0.12.0
npm ERR! missing: minimist@0.0.8, required by mkdirp@0.5.1
npm ERR! missing: minimatch@3.0.4, required by ignore-walk@3.0.1
npm ERR! missing: brace-expansion@1.1.11, required by minimatch@3.0.4
npm ERR! missing: balanced-match@1.0.0, required by brace-expansion@1.1.11
npm ERR! missing: concat-map@0.0.1, required by brace-expansion@1.1.11
npm ERR! missing: console-control-strings@1.1.0, required by npmlog@4.1.2
npm ERR! missing: inherits@2.0.3, required by readable-stream@2.3.6
npm ERR! missing: safe-buffer@5.1.2, required by readable-stream@2.3.6
npm ERR! missing: safe-buffer@5.1.2, required by string_decoder@1.1.1
npm ERR! missing: console-control-strings@1.1.0, required by gauge@2.7.4
npm ERR! missing: string-width@1.0.2, required by gauge@2.7.4
npm ERR! missing: strip-ansi@3.0.1, required by gauge@2.7.4
npm ERR! missing: code-point-at@1.1.0, required by string-width@1.0.2
npm ERR! missing: is-fullwidth-code-point@1.0.0, required by string-width@1.0.2
npm ERR! missing: strip-ansi@3.0.1, required by string-width@1.0.2
npm ERR! missing: number-is-nan@1.0.1, required by is-fullwidth-code-point@1.0.0
npm ERR! missing: ansi-regex@2.1.1, required by strip-ansi@3.0.1
npm ERR! missing: string-width@1.0.2, required by wide-align@1.1.3
npm ERR! missing: inherits@2.0.3, required by glob@7.1.3
npm ERR! missing: minimatch@3.0.4, required by glob@7.1.3
npm ERR! missing: once@1.4.0, required by glob@7.1.3
npm ERR! missing: once@1.4.0, required by inflight@1.0.6
npm ERR! missing: wrappy@1.0.2, required by inflight@1.0.6
npm ERR! missing: wrappy@1.0.2, required by once@1.4.0
npm ERR! missing: minipass@2.3.5, required by tar@4.4.8
npm ERR! missing: mkdirp@0.5.1, required by tar@4.4.8
npm ERR! missing: safe-buffer@5.1.2, required by tar@4.4.8
npm ERR! missing: yallist@3.0.3, required by tar@4.4.8
npm ERR! missing: minipass@2.3.5, required by fs-minipass@1.2.5
npm ERR! missing: safe-buffer@5.1.2, required by minipass@2.3.5
npm ERR! missing: yallist@3.0.3, required by minipass@2.3.5
npm ERR! missing: minipass@2.3.5, required by minizlib@1.2.1

@laurencefass
Copy link
Author

laurencefass commented Oct 31, 2019

The proxy plugin 1.1.0 is not working. I have tried installing express@^4.17.1 but it leads to a number of other dependency issues.

image

The exact steps taken to install site showing error above:

npx create-razzle-app myapp
cd myapp
npm install razzle-plugin-proxy@1.1.0

config:

env

PUBLIC_PATH='https://razzle.syntapse.co.uk/razzle'
CLIENT_PUBLIC_PATH='https://razzle.syntapse.co.uk/webpack/razzle'
PORT=3000

nginx

server {
    listen 80;
    server_name razzle.syntapse.co.uk;
    location /razzle {
        # prod or dev (public)
        proxy_pass http://0.0.0.0:3000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    }  
    location  ^~ /razzle/webpack {
        # dev webpack
        proxy_pass http://0.0.0.0:3001/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection 'upgrade';
        proxy_set_header Host $host;
        proxy_cache_bypass $http_upgrade;
    } 
}

@fivethreeo
Copy link
Collaborator

Um?

PUBLIC_PATH='https://razzle.syntapse.co.uk/razzle'
CLIENT_PUBLIC_PATH='https://razzle.syntapse.co.uk/razzle/webpack'

@laurencefass
Copy link
Author

my apologies the correct domain for this stage of testing is app.syntapse.co.uk.

my greater concern is the missing dependencies. is this why its not loading in dev? i dont have sufficient knowledge to know if its been loaded.

@fivethreeo
Copy link
Collaborator

Try removing some parts of the path, where is the file really available at?

@laurencefass
Copy link
Author

I can't continue testing with such a large list of dependency errors on install. is there a way to fix this before i continue? i dont know if the package is even being loaded....

@laurencefass
Copy link
Author

how can it be loading when dependencies are not installed? sorry perhaps i have basic misunderstanding of how this works?

@fivethreeo
Copy link
Collaborator

I only use yarn.

@laurencefass
Copy link
Author

ok. yarn. maybe this is the problem. i will scrap project and install latest with yarn see if it makes a difference.

@laurencefass
Copy link
Author

laurencefass commented Oct 31, 2019

installed with yarn back to same situation i will close this issue and open a new one from latest starting point. too many changes require a new starting point.

is there github repo and issue queue for the proxy plugin?

@fivethreeo
Copy link
Collaborator

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

No branches or pull requests

2 participants