Vagrant: `vagrant share` can't detect HTTP port

Created on 11 Mar 2014  路  30Comments  路  Source: hashicorp/vagrant

Although I have forwarded port 80 and Apache is running on the VM, vagrant share is not able to detected the port:

vagrant share
==> default: Detecting network information for machine...
    default: Local machine address: 127.0.0.1
    default:
    default: Note: With the local address (127.0.0.1), Vagrant Share can only
    default: share any ports you have forwarded. Assign an IP or addres to your
    default: machine to expose all TCP ports. Consult the documentation
    default: for your provider ('virtualbox') for more information.
    default:
Vagrant was unable to detect an HTTP port for your machine.

Because your machine appears to have no static IP associated with
it, Vagrant scans through your forwarded ports, looking for one
that responds to an HTTP request. Vagrant couldn't find any
functioning HTTP port!

There are a few options to fix this error:

  1. Create a forwarded port pointing to your HTTP server inside
     your Vagrant machine.

  2. Specify an HTTP port manually with `--http-port` to this
     command.

  3. Assign a non-local address to your machine. This may or may
     not be possible depending on what provider you're using.

  4. Make sure that the HTTP server is up and running within
     your machine. Vagrant share won't start until it is
     reachable.

Did I miss something?

Most helpful comment

Did a new install of vagrant yesterday and from then on "vagrant share" stopped working with the same errors as original poster.

When I type "vagrant share --http 80" it works. What the hell is causing this? This is bad, because PHPstorm only has "Vagrant share" built in and I have to open the terminal now and cd into the right folder first, which takes some time.

What's really puzzling is: why did it work before? I did a clean install (removed virtualbox + vagrant first).

All 30 comments

Can you attach a full debug log?

Yep, sorry for not doing it in the first place.
https://gist.github.com/thasmo/80755160f3f11686a987

Can you visit http://127.0.0.1:80/ and it loads? The plugin is reporting that it couldn't connect to that address. If it is working, then what is it responding with (http 200?)

Usually, below port 1024, you need admin privileges. That might be the issue. Try forwarding HTTP to higher than 1024.

Request:

GET / HTTP/1.1
Host: 127.0.0.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: de,de-at;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
DNT: 1
Cookie: PHPSESSID=tdsbav69n9g3pdtta03fgj5ag4
Connection: keep-alive
Cache-Control: max-age=0

Response:

HTTP/1.1 200 OK
Date: Tue, 11 Mar 2014 16:22:04 GMT
Server: Apache
X-Powered-By: PHP/5.4.9-4ubuntu2.4
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=5, max=95
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

Super weird. The vagrant plugin is not getting a 200. Can you try with another port forwarding? Try 8080

Elevated prompt (run as admin) doesn't work either - going to try another port.

Using port 1234 seems to work _but only if the prompt is elevated too_, although I can't use it because I still can't use vagrant login. When booting the box I also get this all the time, but I think it's unrelated:

==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Error: Connection timout. Retrying...
==> default: Machine booted and ready!

Yeah that looks fine to me (the last bit).

Yeah the port issue I'm pretty confident is a strange Windows and permissions issue on the firewall. Lets solve your login problem.

I ran in to this issue. I managed to get it going by running both the prompt (in my case Git bash) and the VirtualBox GUI elevated. And to get the VB GUI running elevated, you have to halt all running VM's before starting it.

With both prompt and VB GUI running elevated, it happily shared ...

...
Hugh@ARTHUR /f/vagrant/joomlatools
$ vagrant share
==> default: Detecting network information for machine...
default: Local machine address: 33.33.33.58
default: Local HTTP port: 80
default: Local HTTPS port: disabled
==> default: Checking authentication and authorization...
==> default: Creating Vagrant Share session...
default: Share will be at: xxxx-xxxxxxxx-7797
==> default: Your Vagrant Share is running! Name: xxxx-xxxxxxxx-7797
==> default: URL: http://xxxx-xxxxxxxx-7797.vagrantshare.com
...

-- hugh

I had to do --http 80 manually even if it states that default http ports are detected automatically.

@IljaN had to do the same on OS X. There was no need to forward any ports via config.vm.network

@mitchellh Can we have this reopened or should I create a new issue?

@mitchellh @kmark I installed Vagrant 1.7.2 on Windows x64 and got the same error message. Has this issue been resolved?

@IljaN Thanks! Specifying the port worked like a charm.

@swreeser @mitchellh Not that I know of.

I am on OSX 10.11.1 and using vagrant 1.7.4

vagrant share --http 80 worked for me as well.

Thanks @IljaN

Did a new install of vagrant yesterday and from then on "vagrant share" stopped working with the same errors as original poster.

When I type "vagrant share --http 80" it works. What the hell is causing this? This is bad, because PHPstorm only has "Vagrant share" built in and I have to open the terminal now and cd into the right folder first, which takes some time.

What's really puzzling is: why did it work before? I did a clean install (removed virtualbox + vagrant first).

Installed new Vagrant box through bash file. Can access it through ip and vhost url.

Running "vagrant share" does not work, vagrant can not find the http port.
Running "vagrant share --http 80" generates a URL. Accessing that url on the browser does not work.

Any ideas why?

```==> default: Detecting network information for machine...
default: Local machine address: 127.0.0.1
default:
default: Note: With the local address (127.0.0.1), Vagrant Share can only
default: share any ports you have forwarded. Assign an IP or address to your
default: machine to expose all TCP ports. Consult the documentation
default: for your provider ('virtualbox') for more information.
default:
Vagrant was unable to detect an HTTP port for your machine.

Because your machine appears to have no static IP associated with
it, Vagrant scans through your forwarded ports, looking for one
that responds to an HTTP request. Vagrant couldn't find any
functioning HTTP port!

There are a few options to fix this error:

  1. Create a forwarded port pointing to your HTTP server inside
    your Vagrant machine.

  2. Specify an HTTP port manually with --http to this command.

  3. Assign a non-local address to your machine. This may or may
    not be possible depending on what provider you're using.

  4. Make sure that the HTTP server is up and running within
    your machine. Vagrant share won't start until it is
    reachable.
    ```

vagrant share --http 80 ==> default: Detecting network information for machine... default: Local machine address: 127.0.0.1 default: default: Note: With the local address (127.0.0.1), Vagrant Share can only default: share any ports you have forwarded. Assign an IP or address to your default: machine to expose all TCP ports. Consult the documentation default: for your provider ('virtualbox') for more information. default: default: Local HTTP port: 80 default: Local HTTPS port: disabled default: Port: 2222 default: Port: 3306 ==> default: Checking authentication and authorization... ==> default: Creating Vagrant Share session... default: Share will be at: antsy-musk-7827 ==> default: Your Vagrant Share is running! Name: antsy-musk-7827 ==> default: URL: http://antsy-musk-7827.vagrantshare.com ==> default: ==> default: You're sharing your Vagrant machine in "restricted" mode. This ==> default: means that only the ports listed above will be accessible by ==> default: other users (either via the web URL or using `vagrant connect`).

I have the same problem. Since yesterday not even vagrant share --http 80 works.

I have the same messages like you posted above.

When trying to access the vagrant link I get:

The cold-bear-7253.vagrantshare.com page isn鈥檛 working

cold-bear-7253.vagrantshare.com is currently unable to handle this request.
HTTP ERROR 500

After upgraded vagrant to the latest 1.9.1 (prior was running 1.8.7)
Vargant share didn't work anymore
Even though I could use --http 80 to eliminate the error message, but the web url is not accessible.

In my case I could make it work with:
vagrant share --http 8000

...but I guess that could be more Laravel/Homestead specific (I use its box). Still worth a try...

After I fallback to version 1.8.7
The problem gone.

Went back to 1.8.6 and vagrant share --http 80 worked again.

Then I went back to 1.8.5 and I could even use plain vagrant share (which is built into PHPstorm and great to use!).

The rest of my setup is VirtualBox 5.1 on Win 10.

@elasticsteve

I could use vagrant share (without specific http port 80 ) on 1.8.7

I fixed it by adding these lines in the end of Vagrantfile:

Vagrant.configure("2") do |config|
    config.vm.network "forwarded_port", guest: 80, host: 8000, auto_correct: true
end

It could not find where to forward ports. Now it works but very slow.

@mylonasg88 Added but still does not work, it freezes and creates a link is nothing
image

@mylonasg88 that solution worked for me too, but like you said, it is painfully slow... I mean it won't work after hitting 3 pages...

@mylonasg88 I reverted to 1.8.7 and it seems to have fixed it .
( using vBox 5.1.10 ) on mac OSX serria

I'm adding my +1 to this.

1.8.7 worked fine, 1.9.1 no longer works. Reverting back to 1.8.7 and it works again.

I do this:
vagrant share --domain a.b.c.d --name myname --http 80

On 1.9.1, accessing through http://name.a.b.c.d share just hangs indefinitely. As soon as I kill vagrant share, I get error in browser so I know it's getting through to my machine.

Revert back to 1.8.7 and domain http://name.a.b.c.d works perfectly again.

OSX El Capitan.

Same problem here, but as I'm new to Vagrant and Laravel Homestead, I've never been able to setup a working vagrant share...

Hey , i can get it to create a share URL but i cant access it outside of my laptop. connections timeout

There are tons of problems with Vagrant Share. This really sucks and didn't get solved for a long time now. I'm stuck at version 1.8.6 and it's slow as hell too! Docker might be the future, but then again, I don't know if you can share your environment with the outside like we do in Vagrant. I guess not very easily.

Was this page helpful?
0 / 5 - 0 ratings