Skip to content
This repository has been archived by the owner on Apr 6, 2021. It is now read-only.

Rail's Webpacker issue with localhost and 0.0.0.0 on C9 #405

Closed
ytbryan opened this issue Apr 1, 2017 · 5 comments
Closed

Rail's Webpacker issue with localhost and 0.0.0.0 on C9 #405

ytbryan opened this issue Apr 1, 2017 · 5 comments

Comments

@ytbryan
Copy link

ytbryan commented Apr 1, 2017

The issue is found here rails/webpacker#176 (comment)

@ytbryan ytbryan changed the title Does anybody at C9 wish to follow on this issue here https://github.com/rails/webpacker/issues/176#issuecomment-290899738 Does anybody at C9 wish to follow up on this issue here https://github.com/rails/webpacker/issues/176#issuecomment-290899738 Apr 1, 2017
@aalvrz
Copy link

aalvrz commented Apr 1, 2017

I think it would be good idea to rename the title to include Webpack issues in Cloud 9.

@nightwing
Copy link
Member

Seems like webpacker doesn't handle correctly the case when it is running behind a proxy, which i'd say is a bug. It assumes that host passed for listening is the same one which should be used for loading the scripts. Usually it is a good idea to use locathion.hostname on the client side, if the passed hostname is 0.0.0.0 (browserify does this)

As a workaround could you try adding a mapping from your preview hostname to 0.0.0.0 in /etc/hosts

echo "0.0.0.0 $C9_HOSTNAME" | sudo tee -a /etc/hosts

and then passing $C9_HOSTNAME instead of 0.0.0.0 to the webpacker?

@ytbryan ytbryan changed the title Does anybody at C9 wish to follow up on this issue here https://github.com/rails/webpacker/issues/176#issuecomment-290899738 Rail's Webpacker issue with localhost and 0.0.0.0 on C9 Apr 1, 2017
@aalvrz
Copy link

aalvrz commented Apr 2, 2017

@nightwing Thanks for chiming in.

I tried your suggestion. It does allow running the webpack dev server using $C9_HOSTNAME. However, when loading up the application, I find this in the browser console:

c9_webpacker

A detailed look into the response data of one of those requests shows:

<html>
  <head>
    <meta charset='utf-8'> 
    <title>ECONNRESET: Request could not be proxied!</title>

<!-- ... -->

I am not sure if this is a C9 issue now, or if the javascript_pack_tag tags are pulling from the appropriate location...?

CC @ytbryan

@nightwing
Copy link
Member

@BigChief45 could you give me access to an example cloud9 workspace where i can debug this? I've tried to create one but didn't succeed as i am not familiar with ruby,

@aalvrz
Copy link

aalvrz commented Apr 3, 2017

Gave it another try and indeed modifying /etc/hosts as @nightwing suggested works.

Thanks for all the help everyone.

@ytbryan I think you can close this issue now.

@ytbryan ytbryan closed this as completed Apr 3, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants