6

I'm using the starter provided by mean.io for a simple MEAN application. Under development I don't have issues with sockjs-node requests:

http://localhost:3000/sockjs-node/info?t=1515290831331

However, once I deploy on Heroku, the application fails to load data using the following requests:

 http://sleepy-escarpment-60068.herokuapp.com:8817/sockjs-node/info?t=1515290831331

I decided to test that request using postman, but I had no success as well. However, I noticed a minor issue when trying to request data from that URL. It was that when deployed on Heroku, it adds the port assigned by Heroku which is 8817 in my case. I decided to test a similar URL, but this time without using heroku's port (8817):

http://sleepy-escarpment-60068.herokuapp.com/sockjs-node/info?t=1515290831331

In this scenario, I could receive a response data. Therefore, my idea is to change the path of the URL once the app sends the request from:

http://sleepy-escarpment-60068.herokuapp.com:8817/sockjs-node/info?t=1515290831331

to

http://sleepy-escarpment-60068.herokuapp.com/sockjs-node/info?t=1515290831331

However, I'm not sure neither how to do it, nor where to apply this solution on the application. I've been googling around to find a solution for the /sockjs-node/info?t=1515290831331 issue and people suggest to redirect the request using the webpack.dev.js file:

 devServer: {
    port: METADATA.port,
  host: METADATA.host,
  historyApiFallback: true,
  watchOptions: {
    // if you're using Docker you may need this
    // aggregateTimeout: 300,
    // poll: 1000,
    ignored: /node_modules/
  },
  disableHostCheck: true,

  proxy: {
     '**/sockjs-node':  {
       changeOrigin: true,
       pathRewrite: {
         '**/sockjs-node': '/test'
       }
     },
  }

I haven't had success trying to implement that solution. Am I doing something wrong on my code? Is that the right solution for the "/sockjs-node/info?t=1515290831331 failed to get response data" issue after deploying my app to Heroku?

areales
  • 121
  • 1
  • 1
  • 6

0 Answers0