[GH-ISSUE #38] Local filesystem provider #13

Closed
opened 2026-03-04 23:23:44 +03:00 by kerem · 4 comments
Owner

Originally created by @Muffinman on GitHub (Nov 10, 2017).
Original GitHub issue: https://github.com/yswery/PHP-DNS-SERVER/issues/38

Hi,

Just thought you might like to know that I've forked and added support for local filesystem lookups.

e.g. host -a dev.example.com 127.0.0.1 could check to see if /path/to/example.com exists locally and return 127.0.0.1 if found.

It can also be configured to work with domain suffixes e.g. example.com.dev or example.com.localhost

I'm finding this useful for local web development as I don't need to keep editing my hosts file every time I work on a new site, providing my folder structure is consistent.

Wasn't sure if that functionality was within the scope of this project so I didn't want to open as a PR.

https://github.com/Muffinman/PHP-DNS-SERVER/blob/master/src/DirStorageProvider.php

Originally created by @Muffinman on GitHub (Nov 10, 2017). Original GitHub issue: https://github.com/yswery/PHP-DNS-SERVER/issues/38 Hi, Just thought you might like to know that I've forked and added support for local filesystem lookups. e.g. `host -a dev.example.com 127.0.0.1` could check to see if `/path/to/example.com` exists locally and return 127.0.0.1 if found. It can also be configured to work with domain suffixes e.g. `example.com.dev` or `example.com.localhost` I'm finding this useful for local web development as I don't need to keep editing my hosts file every time I work on a new site, providing my folder structure is consistent. Wasn't sure if that functionality was within the scope of this project so I didn't want to open as a PR. https://github.com/Muffinman/PHP-DNS-SERVER/blob/master/src/DirStorageProvider.php
kerem closed this issue 2026-03-04 23:23:44 +03:00
Author
Owner

@codenamegary commented on GitHub (Apr 15, 2018):

That is clever and it looks really good! You should open a PR.

<!-- gh-comment-id:381408440 --> @codenamegary commented on GitHub (Apr 15, 2018): That is clever and it looks really good! You should open a PR.
Author
Owner

@Muffinman commented on GitHub (Apr 15, 2018):

Unfortunately although the DNS server seemed to work fine, I found that half the time chrome would just fail rather than pass requests to the local DNS server.

Didn't have time to debug it properly and eventually just went back to editing my hosts file.

<!-- gh-comment-id:381410432 --> @Muffinman commented on GitHub (Apr 15, 2018): Unfortunately although the DNS server seemed to work fine, I found that half the time chrome would just fail rather than pass requests to the local DNS server. Didn't have time to debug it properly and eventually just went back to editing my hosts file.
Author
Owner

@codenamegary commented on GitHub (Apr 18, 2018):

I believe that's entirely due to this change in Chrome, specific to the ".dev" TLD.

https://laravel-news.com/chrome-63-now-forces-dev-domains-https

This will probably still work fine if you use .local or something along those lines.

<!-- gh-comment-id:382382068 --> @codenamegary commented on GitHub (Apr 18, 2018): I believe that's entirely due to this change in Chrome, specific to the ".dev" TLD. https://laravel-news.com/chrome-63-now-forces-dev-domains-https This will probably still work fine if you use .local or something along those lines.
Author
Owner

@Muffinman commented on GitHub (Apr 20, 2018):

Not in my case, my local domain formats are dev.example.com so that my password manager picks up the correct passwords for the parent domain.

It really did seem random where it would work for some domains but not others, and then would randomly stop working all together.

I'm pretty sure it was something specific to Chrome as any dig / host lookups worked perfectly from the command line, as did Safari when I tested that.

If I had to guess I would say it's a limitation of hosting a DNS service on localhost / 127.0.0.1, maybe if I bound it to another IP it may work.

<!-- gh-comment-id:383063035 --> @Muffinman commented on GitHub (Apr 20, 2018): Not in my case, my local domain formats are **dev.example.com** so that my password manager picks up the correct passwords for the parent domain. It really did seem random where it would work for some domains but not others, and then would randomly stop working all together. I'm pretty sure it was something specific to Chrome as any `dig` / `host` lookups worked perfectly from the command line, as did Safari when I tested that. If I had to guess I would say it's a limitation of hosting a DNS service on localhost / 127.0.0.1, maybe if I bound it to another IP it may work.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/PHP-DNS-SERVER#13
No description provided.