Accessing apache on a vagrant sandbox using ssl (port forwarding)

1,434 views
Skip to first unread message

Mark Baker

unread,
Aug 12, 2011, 5:00:54 AM8/12/11
to Vagrant
I've built a vagrant/virtualbox web server as a development sandbox,
and configured apache in the VM for ssl (on the default port 443, with
a self-signed certificate). I've tested pages on the VM itself using
curl

curl -v -k https://mysite.mydomain.com/testSearch/results?postcode=WN8+0BA

and it seems to work quite happily, so I'm satisfied that apache is
correctly configured and working in the VM.

However, when I try to access the VM from my host's browsers over
https, I'm unable to do so.

I've added

config.vm.forward_port "https", 443, 8443

to my vagrantfile, but trying to access the url

https://mysite.mydomain.com:8443/testSearch/results?postcode=WN8+0BA

simply can't display the page I've tried with several different
browsers: IE gives a meaningless "Internet Explorer cannot display the
webpage"; Chrome gives

SSL connection error
Unable to make a secure connection to the server. This may be a
problem with the server or it may be requiring a client authentication
certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.

Firefox gives me

An error occurred during a connection to mysite.mydomain.com:8443.
SSL received a record that exceeded the maximum permissible
length.
(Error code: ssl_error_rx_record_too_long)

but even the Firebug Net tab doesn't tell me anything more than that.


I'm not getting anything in the access or error logs on the VM apache,
so I suspect that vagrant isn't forwarding the ssl at all.


• VM Guest OS: centos56x64
• Host: Windows 7 64-bit
• JRuby: 1.6.3 (ruby-1.8.7-p330) (2011-07-07 965162f) (Java
HotSpot(TM) 64-Bit Server VM 1.6.0_24) [Windows 7-amd64-java]
• Vagrant: 0.7.8
• VirtualBox: 4.0.12


Any assistance would be gratefully accepted.

Mitchell Hashimoto

unread,
Aug 16, 2011, 12:57:56 AM8/16/11
to vagra...@googlegroups.com
Mark,
Hm, correct me if I'm wrong, but I think SSL can only run on port 443. For this reason, you can't use port forwarding to test SSL. The easiest way to test SSL at the moment is to use a host only network instead: http://vagrantup.com/docs/host_only_networking.html

Then you can just use your static IP which SSL will work on. 

Best,
Mitchell

John D. Hume

unread,
Aug 16, 2011, 9:12:13 AM8/16/11
to vagra...@googlegroups.com

I'm fairly certain SSL can run happily on other ports. RapidFTR runs a just-passed-CI instance on port 3443 and I use vagrant to do forwarding of an SSL port locally.

-- typed with my thumbs

Reply all
Reply to author
Forward
0 new messages