-
-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot perform GET requests to local apache webserver setup with VirtualDocumentRoot #150
Comments
If you use another HTTP client it works perfectly fine I guess (other than your browser)? Do you have HTTPS configured? If you're using Chrome, it might automatically use HTTPS, see https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/. You should probably move your development off of |
Does artax send a HTTP_HOST header? |
@staabm Yes, of course. |
Hi @kelunik, Anyway I have an interesting update. If I add the I'm gonna do some other investigation, I'll keep you up to date. |
@mmenozzi could you use some debugging switches (or a http proxy) or similar to compare the http traffic of artax with one of the working clients? |
@staabm Not necessary, it's the DNS resolution then. @mmenozzi We use a custom DNS resolver, because the system-provided APIs are blocking and thus unsuited. How does your |
Ok @kelunik I see the custom DNS resolver. I use
This is my
But I also have the file
To investigate further I created the following test script: <?php
use Amp\Loop;
require __DIR__ . '/vendor/autoload.php';
Loop::run(function () {
$ip = yield \Amp\Dns\resolve('myproject.dev');
var_dump($ip);
}); and the output is:
With the same script, if I put the entry into
But in both ways the output of the
and in both ways the output of the |
How does your system resolver find |
I have no idea @kelunik. I have to investigate. I'll keep you up to date. |
Hi @kelunik, At the
So I think that the macOS DNS resolver looks up for files in the If you think it's worth it, the Otherwise I think it's perfectly fine to assume that Feel free to close this issue. |
Have you manually configured it to use @amphp/dns opinions? |
No I didn't configured it. I just followed an online tutorial like this: https://www.fourkitchens.com/blog/article/local-development-apache-vhosts-and-dnsmasq/ From what I understand it's the builtin behavior of the macOS's resolver, it looks for files inside /etc/resolver before falling back to /etc/resolve.conf |
@mmenozzi I'm going to close this issue here. Could you open an appropriate issue for |
Done: amphp/dns#69 |
Hi guys,
I have a problem similar to the issue #138 but it happens in a very weird manner so I don't think is related to that issue but the error message is the same:
Socket disconnected prior to response completion (Parser state: 0)
. I'll explain the whole story.I have a Mac Book Pro as a development machine and I have a simply Apache + PHP + MySQL setup. I have to work on several projects so to speedup the setup of every new project I configured Apache with
VirtualDocumentRoot
directive (here an example of my configuration http://roberto-montero.com/blog/how-setup-xampp-use-virtualdocumentroot-mac-os-x). I have also a virtual host configured forlocalhost
whose document root is the root of my workspace (the directory which contains all of my projects,~/Work/Projects
).So if go to
http://localhost/phpinfo.php
, I get the phpinfo located in the root of all my projects (~/Work/Projects/phpinfo.php
). Instead if I go tohttp://myproject.dev/phpinfo.php
I get the phpinfo located in the directory of "myproject" (~/Work/Projects/myproject/phpinfo.php
).Ok, given this scenario, I wanted to use this async HTTP client to perform HTTP requests against a project which I'm working on.
So I installed artax using composer and simply copy & pasted your example n. 1 (https://github.com/amphp/artax/blob/master/examples/1-get-request.php) to perform a simple GET request.
First I tried with the URL provided in the example (
https://httpbin.org/user-agent
) and it worked.But then, I tried with my local project using the URL
http://myproject.dev/phpinfo.php
, and this last trial didn't work. I got the errorSocket disconnected prior to response completion (Parser state: 0)
.After several trials I figured out that if I use
http://localhost/phpinfo.php
it works. So I tried with several different request to other resources/projects and the pattern that I found is that:http://localhost/
are workingVirtualDocumentRoot
virtual hosts (likehttp://myproject.dev/
) are not working.Please note that all of them are served from my dev machine (so Apache is the same, PHP is the same, etc...) and all my trials are with the same sample script.
So it seems (but I would like to confirm) that there is some weird circumstance that cause that error only if use a
VirtualDocumentRoot
virtual host.Now, I would like to understand what the f**k is going on but I have no idea where to start. Do you guys have any suggestion? 😄
Thank you.
The text was updated successfully, but these errors were encountered: