1

I am trying to setup a reverse proxy to a Cloud9 instance running locally on my server using Apache. I have the following setup:

<VirtualHost *:80>
  ProxyPreserveHost On
  ProxyPass / http://localhost:3131/
  ProxyPassReverse / http://localhost:3131/
  ServerAdmin [email protected]
  ServerName cloud9.mydomain.org
</VirtualHost>

I have also tried re-ordering the directives so the ServerAdmin and ServerName came first. So far, if I hit http://cloud9.mydomain.org, I get a browser error saying it could not connect. There is nothing logged in Apache's access.log or error.log either. I am thinking that I am missing some piece, but I am not sure as to what that missing piece might be yet. I also don't know if I am looking in the right place for logs. The Cloud9 process was started, and appears to be running on the 3131 port.

I don't plan to run Cloud9 wide open. The end-game I am shooting for is to eventually get Cloud9 hosted through SSL using some auth, maybe basic auth, but I figured before I started adding SSL and auth into the mix, I should probably get the basics working first.

Update Output of apachectl -S:

# apachectl -S
VirtualHost configuration:
wildcard NameVirtualHosts and _default_ servers:
*:80                   is a NameVirtualHost
         default server www.mydomain.org (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost www.mydomain.org (/etc/apache2/sites-enabled/000-default:1)
         port 80 namevhost wp.mydomain.org (/etc/apache2/sites-enabled/001-wordpress:1)
         port 80 namevhost blog.mydomain.org (/etc/apache2/sites-enabled/001-wordpress:22)
         port 80 namevhost cloud9.mydomain.org (/etc/apache2/sites-enabled/003-cloud9:1)
Syntax OK

Output of curl -I cloud9.mydomain.org:

curl: (6) Couldn't resolve host 'cloud9.mydomain.org'

Output of curl -I localhost:3131:

HTTP/1.1 403 Forbidden
Content-Type: text/plain
Content-Length: 9
Set-Cookie: cloud9.sid.3131=bqk4zxV4ETq9rrO79E4mkJn9.YW7gMDRCsOO95utQJy1mYm8LfTfZC%2F7Fx59DeFRFDpU; path=/; expires=Thu, 19 Sep 2013 02:07:41 GMT; httpOnly
Date: Wed, 18 Sep 2013 22

When I try to hit the site externally using Chrome, I get:

Oops! Google Chrome could not find cloud9.mydomain.org

Did you mean: mydomain.org

Which is the default page Chrome displays when it cannot connect. Again, I don't see any errors in the access.log or error.log, unless for some reason it's not logging in the same place. I am going into /var/log/apache2 and doing an ls -lart to make sure I am seeing the latest log file.

3
  • Could you also test this from the local machine with curl -I cloud9.mydomain.org and let us know what you get?
    – zygis
    Sep 18, 2013 at 16:34
  • I will do that as soon as I get home and will report back.
    – CodeChimp
    Sep 18, 2013 at 19:51
  • I updated the post with the requested output
    – CodeChimp
    Sep 18, 2013 at 22:30

2 Answers 2

0

<VirtualHost *.80> - change that to <VirtualHost *:80>.

That might be all that's needed, but if not, can you provide the output of apachectl -S?

5
  • It was a typo. I only had access from work using iSSH on my cellphone, so I did not have the ability to copy/past. I corrected the original post to reflect the correct value.
    – CodeChimp
    Sep 18, 2013 at 19:53
  • @CodeChimp Ok - then can you provide the output from apachectl -S? Also, what error is your client browser having - is name resolution and basic TCP connectivity to the web server working? Sep 18, 2013 at 19:54
  • I updated the posting above with the requested output.
    – CodeChimp
    Sep 18, 2013 at 22:30
  • @CodeChimp The first thing you need is to add a DNS record for cloud9.mydomain.com - until the name resolves, you won't be able to connect to it (though you can use a hosts file locally to get past that for now and see if the rest of your configuration is working). Sep 19, 2013 at 0:16
  • You gave me my "duh" moment. Server troubleshooting 101...if you don't see any logs in your server, make sure you are actually getting to your server.
    – CodeChimp
    Sep 20, 2013 at 11:27
0

Not pretty, but this works for both HTTP and SSL wo/ changes to Cloud9.

Necessary Apache module: mod_proxy_wstunnel (available in Apache 2.4 I think, and tutorials to build for Apache 2.2.x are available, e.g. http://www.amoss.me.uk/2013/06/apache-2-2-websocket-proxying-ubuntu-mod_proxy_wstunnel/).

ProxyPreserveHost On

RewriteEngine On
RewriteCond %{QUERY_STRING} transport=polling
RewriteRule ^(.*)smith.io(.*) /polling [P]

<Location />
   ProxyPass http://localhost:3131/
   ProxyPassReverse http://localhost:3131/
</Location>
<Location /smith.io>
   ProxyPass ws://localhost:3131/smith.io
   ProxyPassReverse ws://localhost:3131/smith.io
</Location>
<Location /polling>
   ProxyPass http://localhost:3131/smith.io/server
   ProxyPassReverse http://localhost:3131/smith.io/server
</Location>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .