Cloudflare tunnel is forwarding to local IP

Hello all,
This may be an amateur mistake on my end.
When browsing to the domain name I am tunneling for, I am redirected to a local IP address instead of the application:

  1. I browse to learn.cndlabs.com
  2. When you go to said domain you get routed to https://192.168.50.229
![image|690x192](upload://dhnInRthQCxCZx6FVPPzOwZUplJ.png) I have a tunnel created and running (Shows Healthy)


I also have the network as a route in routes

I am hard stuck. Any help would be appreciated

You are going to want it as an application and public hostname instead of a route. Routes are more VPN like

I deleted all my routes and such in the dashboard, removed cloudflared, reinstalled, went through the configuration process on the dashboard again and I get the same error.

Its almost seeming like instead of doing a proxy type action, its just referring to the other IP. The connection is made from an external source > goes to cloudflare > hits cloudflared > tries to access the internal IP. Thank you for the help so far!


The config is basic. Maybe I am missing something?

The response headers returned are:

< HTTP/1.1 303 See Other
< Date: Mon, 12 Feb 2024 01:37:36 GMT
< Content-Type: text/html; charset=UTF-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< content-language: en
< location: https://192.168.50.229
< x-redirect-by: Moodle
< CF-Cache-Status: DYNAMIC
< Report-To: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=HK2F6sMLTOwcCjlXOQcUBRI8QM7IkXozXjLB9su6dH4xTMoXja8G1bFSsomBkV8MOafecfhinUKIZjytK9SUYM30DOlu3niQUYPDHNAFm06TtBkja7i0vWlP2K%2F%2FeiXwc35kmjvZqpz%2BSbl2gKCrng%3D%3D"}],"group":"cf-nel","max_age":604800}
< NEL: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< Server: cloudflare
< CF-RAY: 85411b7719a354b8-MAN
< alt-svc: h3=":443"; ma=86400
<

Note specifically this part:

< x-redirect-by: Moodle
< CF-Cache-Status: DYNAMIC
  1. The CF-Cache-Status: DYNAMIC indicates that the response is coming from a remote origin server and not from Cloudflare or cloudflared directly. If you are curious you can read about these here: Default Cache Behavior · Cloudflare Cache (CDN) docs
  2. The x-redirect-by: Moodle is a header sent by the origin server which betrays that the redirect is in fact being sent by the Moodle software.

Most likely Moodle has a check for whether the hostname of the request (in this case learn.cndlabs.com) is the same as the hostname that is configured as the canonical(primary) hostname that it is expecting the website to be served on. (Evidently this is configured as 192.168.50.229) And when these differ, it redirects you to the “correct” hostname.

The fix would be to change the Moodle domain to your domain instead of the IP. I do not have experience with Moodle however was able to find these resources:

2 Likes

This did the trick! Thank you for your help!

2 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.