Skip to content
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

Question: subdomains? #387

Open
quillaja opened this issue Aug 12, 2022 · 2 comments
Open

Question: subdomains? #387

quillaja opened this issue Aug 12, 2022 · 2 comments

Comments

@quillaja
Copy link

Can sniproxy route subdomains to different addresses? I did attempt to test it and I think my requests to the subdomain were going to the incorrect server (eg sub1.mydomain.net went to 127.0.0.1:8000 mydomain.net), but it's possible I had something else with DNS misconfigured.

Partial config for example:

listen 80 {
	proto http
	table http_hosts

	access_log {
		filename /var/log/sniproxy/http_access.log
		priority notice
	}
}

table http_hosts {
	mydomain.net 127.0.0.1:8000
	sub1.mydomain.net 127.0.0.1:8001
	sub2.mydomain.net 127.0.0.1:8002
}
@erictapen
Copy link

I'm stumbling over the same problem, even though the configuration you are showing fixed it for me. Apparently the order in http_hosts matters for non-regex entries? This is not intuitive imo.

listener 443 {
  protocol dns
  table http_hosts
}

table http_hosts {
  example.com fc00::1
  sub.example.com fc00::2
}

routes all requests to sub.example.com via fc00::1. Switching the order fixed the problem for me:

listener 443 {
  protocol dns
  table http_hosts
}

table http_hosts {
  sub.example.com fc00::2
  example.com fc00::1
}

Unfortunately my configuration generator doesn't easily allow to specify the order in http_hosts and as a user I wouldn't want to care about it for non-regex entries. Would it be possible to change this or at least document the handling of subdomains in big red letters?

@quillaja
Copy link
Author

quillaja commented Apr 7, 2023

@erictapen I'll try changing the order and see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants