I have two diaries, one of what I eat the other is this one :e.

How to fix www not accessible in cloudflare tunnel.

When we created our cloudflare tunnel for Azores-shipping.pt we used the settings bellow:

This will point our service in the container shipping port 81 to the domain Azores-shipping.pt using cloudflare tunnel, but cloudflare will only serve the website to Azores-shipping.pt and not www.azores-shipping.pt. To fix this we have 2 solutions, we can create a new tunnel to redirect the docker container to www. or we can use clouflare to do the job for us, this is far better option because we would not need to run a second container for the second tunnel to www.azores-shipping.pt.

SOO Lets do it.

1st login to your cloudflare dashboard and click on your domain.

next to to DNS/Records and you will find something similar with what is below:

as you can see the only record on this domain is to Azores-shipping.pt and it originates on a cloudflare tunnel. What we will do is create a new A record for www.azores-shipping.pt and point it to a fake ip. see the image bellow:

Of course this will not solve anything we just created a A record that goes to a random ip, but now we can use Rules/Page Rules to make the redirect.

so go to Rules/Page rules and click “create new rule”

In Url we will put www.azores-shipping.pt/* , this will make any request for www.azores-shipping.pt be redirected to Azores-shipping.pt, you will need to select forward URL as setting, and 301 permanent redirect. On the last url we will insert Azores-shipping.pt/$1.

After this for example if you try to access www.azores-shipping.pt/test you will be presented with Azores-shipping.pt/test

Leave a Reply

Your email address will not be published. Required fields are marked *