How to add subdomain for Java socket

Assume I have domain called mytest.com setup in cloudflare. I have created A record for www, pointing to Azure. In Azure I have one VM running on Apache to serve http (80) and https (443) at public ip A, for example. All these setup are working fine.

Now I have another VM at Azure to run Java socket at public ip B. I created another A record for subdomain chat.mytest.com pointing to this public ip B, port 443 at Azure.

Somehow, Cloudflare treats this chat.mytest.com, port 443 as web request. When I tried to access from chat socket client, I got this:

HTTP/1.1 400 Bad Request
Server: cloudflare
Date: Thu, 22 Jul 2021 09:41:57 GMT
Content-Type: text/html
Content-Length: 155
Connection: close
CF-RAY: -

<html>
<head><title>400 Bad Request</title></head>
<body>
<center><h1>400 Bad Request</h1></center>
<hr><center>cloudflare</center>
</body>
</html>

May I know how to process this ?

Everything on port 443 has to be an HTTP request (on SSL), you can’t send arbitrary data over such a connection. For that you’d need Spectrum, but that’s Enterprise-only.

  1. Can I just let Cloudflare to manage www.mytest.com, and not at mytest.com level ? This case I can have my own DNS manages mytest.com and set A record of www pointing to Cloudflare.

  2. If I need to surrender mytest.com to Cloudflare, what about my email domain of mail.mytest.com ? Do I need spectrum for this ?

I saw in my DNS section, in my chat.mytest.com there are proxied and dns status. Does this mean if I turn on proxied thus chat.mytest.com is handled by Cloudflare ?

If I turn on DNS only, does this mean I can achieve what I wanted ?

DNS Only means it’s a direct unfettered connection to your server. It should work.

Sure, you can individually proxy and unproxy DNS records. If you connect directly you do not have any limitations and will be able to send that request. As mentioned before though, as long as you proy you will not be able to use anything non-HTTP related unless you are on Spectrum.

But of course, in that case you wouldn’t really be using Cloudflare, in terms of their core service, but only the DNS system.

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