0

Got a main app running on port 3002 and a second one running on port 3000. When using the main app from a browser (tested Chrome, Firefox, Safari), everything works just fine, including mounting the second app in an iframe.

The problem I'm having is when I jump to debug the mobile version on my iPhone's Safari, the main app is failing to load the support app with error message 'Failed to load resource: Could not connect to the server.'

Both apps are Rails applications, with the secondary app running on a WEBrick HTTP Server. On the secondary app I added the following lines in application.rb to for CORS support, with no success:

    config.action_dispatch.default_headers.merge!({
      'Access-Control-Allow-Origin' => '*',
      'Access-Control-Request-Method' => '*'
    })

Another piece of the puzzle: when I switch the secondary app URL to the production one deployed in Heroku, the main app successfully loads it in the iFrame. So--issue is only happening when the secondary app is running locally.

Appreciate any pointers in advance.

bazfer
  • 23
  • 8

1 Answers1

0

Learned about this not too long ago. It explains the why but does not offer a fix.

'You have to access it from another Network not in your network. Because your server is running on IP and your accessing machine is also connected to the same IP[because of port forwarding]. So it will not work in same network. You have to access it from different WAN IP Network.'

cant do port forwarding ro my webrick server to access it from the net!

bazfer
  • 23
  • 8