Reply

why redirecting locally hosted website using rewrite not working

[ Edited ]
New Member
Posts: 2
2786     0

I am learning on my own , I find CoreDNS really exciting its so simple to configure and the plugins based system.

 

I set this up below config for for my locally hosted website and on the same local network I have core dns running in docker

 

.:53 {
    import global
    rewrite name my-self-hosted.dryddns.net 192.168.0.15
    forward . tls://1.1.1.3 {
    tls_servername cloudflare-dns.com
    health_check 10s
    }
    loop
    reload

}

 

I learned this from here: https://coredns.io/2017/05/08/custom-dns-entries-for-kubernetes/

 

however it doesnt work.

 

After adding these setting my-self-hosted.dryddns.net does not open at all.

 

my sceptesim is also on the apache settings where I say 

 

ServerName my-self-hosted.dryddns.net

 

inside <VirtualHost> block.

 

secondly I doubt when I try to navigate in browser to the self-hosted.local it redirect to  my-self-hosted.dryddns.net.

 

I want to be able to drectly connect to locally hosted web app on port 443 directly to the local server ip 192.168.0.15

 

please help.

Re: why redirecting locally hosted website using rewrite not working

New Member
Posts: 2
2786     0

Digging internet, I found something

 

rewrite name gitea.nsc gitea.default.svc.cluster.local

in this case I have a public facing domain name as gitea.nsc and local is called gitea.default.svc.cluster.local

 

which translates to 

 

rewrite stop {
    name regex (.*)\.nsc {1}.default.svc.cluster.local
    answer name (.*)\.default\.svc\.cluster\.local {1}.nsc
}

In this case of name regex (.*) gets replaced by gitea and same matches {1}

and reverse is answer name.

 

however in my situation is the public facing domain name does not matches to the local name at all.

 

and I tried the exact instead of regex but i spotted in coredns log that I have to use regex for the response to work.

 

so if self-hosted.drydns.net is the public facing and local is myhost.local

 

what should rewrite stop should look like in terms of regex or something else.

 

rewrite stop {
name regex self-hosted\.ddns\.net rockpi\.local
answer name rockpi\.local self-hosted\.ddns\.net
}
Showing results for 
Search instead for 
Did you mean: 

Recommended for You