Can't we use localhost as URL in Public Hostname?

I’m trying to access my website on port 8080 like this

but it always returns me 502 bad gateway, but if i change the localhost to local ip, now it’s working. But the thing is, as u can see the example cloudflare given, there’s https://localhost:8001 so i’m wondering do we able to use localhost instead of local ip for the URL?

You sure can! Mine’s not on 8080, but this is what I use. And the example even says you can use localhost.

1 Like

If u try to access my site https://web.natestudio.my.id (use localhost:8080) u’ll get 502 error. but if u access https://localip.natestudio.my.id (use :8080) u’ll get the nginx site. Is there any settings i need to do?

Idk why but it’s always giving me 502 when using localhost

Do you mean 127.0.0.1 when you say “local IP” or do you mean an IP reserved for use in private networks, like 192.168.0.1?

3 Likes

yes it’s 192.168.x.x if i use 127.0.0.1 it’s giving me the same result, 502 errror

localhost means 127.0.0.1, so that is to be expected.

If the tunnel is running on the same device as your webserver, make sure the server is listening on the correct IP address.

1 Like

When i access 127.0.0.1 or localhost or 192.168.x.x from the server it’s working. The tunnel is the same device as my webserver as it’s served in docker, both my nginx and cloudflare

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