Website subdomain port redirect

I have a web server listening on a non-standard port (25593).

My requirement is to have “subdomain.mydomain.com” redirect to that server.

I have a DNS A record for subdomain pointing to the web server’s IP address and have set up an origin rule to rewrite the port to 25593 when the host matches “subdomain.mydomain.com”.

It’s not working - is there something I am missing?

I found this page that talks about restrictions on network ports, but I’m not sure if that is relevant because the origin rules destination port documentation suggests any port number is valid.

Make sure the subdomain DNS record set to “proxied” and not “DNS only”?

Correct, that’s regarding ports that Cloudflare listens to on the edge. Assuming you are using your subdomain without a port when you make the request, then the request will come in from the client to Cloudflare for port 80/443 and be made from Cloudflare to your origin for port 25593.

If you still have problems, if you can give the subdomain and domain.

Hi thanks for responding.

I do have it as proxied (I’ve tried all sorts of things and that’s where it is currently).

The subdomain is map on domain dadenergymc.uk.

It seems to be working for me…
https://cf.sjr.org.uk/tools/check?392642e8c68f478dac3826fa130760af#connection-server-http

It’s working both on HTTP and HTTPS so I suspect you have SSL/TLS set to “Flexible” (so is HTTP to your origin). To secure your site end to end, you should set it to “Full (strict)” ensuring you have a valid SSL certificate on your origin and a redirect from http://map.dadenergymc.uk to https://map.dadenergymc.uk on Cloudflare (without the redirect, HTTP to your HTTPS origin will give an error).

Aha interesting… it was still failing for me, so I opened up an incognito browser window and it is fine.

Noted re the ssl - I need to get the SSL cert on the origin.

Many thanks for your help, sorry it turned out to be user/browser cache error!

1 Like

btw where would that SSL/TLS ‘flexible’ option be?

https://dash.cloudflare.com/?to=/:account/:zone/ssl-tls

1 Like

tysm - I’ll do that once the origin server supports ssl.

1 Like

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