Resolve keywords and https on dnsmasq

dnsmasqdomain-name-system

Using address=/#/192.168.2.1 on /etc/dnsmasq.conf to resolve all domain names for example google.com redirects you to 192.168.2.2 and got that working.

Now how do you resolve any keyword on the browser? For example I type in foo and press enter and get redirected to 192.168.2.2. I get Not Found on my current configuration.

Also is it possible to resolve https urls to 192.168.2.2? I'm currently not running 443 on my web server on 192.168.2.2.

Best Answer

Now how do you resolve any keyword on the browser? For example I type in foo and press enter and get redirected to 192.168.2.2. I get Not Found on my current configuration.

If your redirect is working, then what you have to do is fix your web server. If a user is typing a something in a modern browser it will go into a mode where it will attempt to submit a request to a search engine. So typing foo might be sending you to the address http://www.google.com/search?q=foo. You have redirected the domain name to point at your local web server, but have you setup your web server to handle request for arbitrary URLs? Will your web server know how to handle the /search?q=foo? Since you mention a 'Not Found' I am guessing your server is 404'ing, so the answer is that it currently doesn't.

The method for handling this depends on your web server and requirements. You could possibly setup a generic for all URLs to go to a specific URL. You could create some kind of back end web application that does something with the URL. There are lots of possibilities.

is it possible to resolve https urls

Resolving stuff is happens in DNS. It doesn't matter which protocol you are using. If someone tries to visit an HTTPS URL, it will attempt to access that address you defined.

If you setup your server to accept port 443 connections, then the browser will attempt to negotiate a TLS connection. And depending on how you configure the certificates will report an error or connect, though it would be possible, if you can inject a CA into the client machines, to make this work. It certainly wouldn't be trivial, and again, it would depend on your web server.