Dns validation error code 1004 srv target must be a hostname

Cloudflare code 1004 is triggered while adding DNS records. This is primarily due to invalid format of the records or hindrance caused by Cloudflare proxy.

Webmasters and website owners who worked with Cloudflare might experience a variety of error codes. Cloudflare code 1004 is a common error.

This code is usually triggered when Cloudflare is unable to complete the actions requested by the user.

As a part of our Server Management Services, we have helped online service providers to fix several similar Cloudflare errors.

Today, let’s discuss some tips to fix the code 1004 DNS Validation Error.

What is Cloudflare code 1004?

Cloudflare error 1004 indicates that Cloudflare is unable to complete an action performed by the user. Users normally face this error while adding/editing DNS records in the Cloudflare DNS area. For instance, a typical error message looks like:

Cloudflare code 1004

Causes for Cloudflare code 1004

Cloudflare error 1004 could be triggered due to issues with the DNS records, conflicts with the Cloudflare proxy etc. Some of the common reasons for this error are:

  • Error with DNS records
  • Conflict with Cloudflare proxy
  • Invalid TTL value
  • Browser cache.

Let us now look at the tips to fix each of them.

Error with the DNS records

The most common reason for the Cloudflare code 1004 is an error with the DNS record that the user is trying to add. For instance, while adding A record, ensure that you are adding the correct record without any unwanted spaces and characters. Common mistakes made with DNS record include:

  • While adding A record, verify the IP address of your origin server is correct, is not a Cloudflare IP address, and has not recently been changed by your hosting provider. Also, remove any blank spaces before and after the IP address.
  • While adding a CNAME record, ensure that it is pointing to a hostname. A CNAME record cannot point to an IP address. Instead, add an A record for the IP address and then use the corresponding A record for adding the CNAME record.
  • While entering the MX record, try to enter the records manually instead of copy-pasting them it may also copy hidden characters. Also, use the hostname of the mail server instead of the IP address.

Cloudflare proxy

Some of the DNS records require the Cloudflare proxy to be turned off.  Thus, it would be a good idea to try adding the records after turning off the Cloudflare proxy.

To turn off the Cloudflare proxy, we just need to toggle the cloud icon from orange to grey.

Cloudflare code 1004

Invalid TTL value

Another major reason for the code 1004 is invalid TTL value. Cloudflare recommends using the TTL value between 120 and 2,147,483,647. However, users have a tendency to limit it to a much lower value to reduce the DNS propagation time. This in terms may lead to the DNS validation limit.

If you are not sure about the exact TTL value to be used, a suggested method is to set the TTL value to 1 to set the TTL value to automatic.

Browser Cache

At times this error could be a glitch caused by browser cache. Clearing the browser cache or re-login to the Cloudflare portal from an incognito window helps to overcome this error. Also, there is a known issue in editing Cloudflare DNS records using mobile versions. Thus it would be a good idea to switch to a desktop browser.

[Need assistance to fix Cloudflare errors? We’ll help you.]

Conclusion

In short, Cloudflare code 1004 is triggered while adding DNS records. This is primarily due to invalid format of the records or hindrance caused by Cloudflare proxy. Today we discussed some tips that our Support Engineers follow to fix the error message.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = «owonCMyG5nEQ0aD71QM»;

Webmasters and website owners who worked with Cloudflare might experience a variety of error codes. Cloudflare code 1004 is a common error.

This code is usually triggered when Cloudflare is unable to complete the actions requested by the user.

As a part of our Server Management Services, we have helped online service providers to fix several similar Cloudflare errors.

Today, let’s discuss some tips to fix the code 1004 DNS Validation Error.

What is Cloudflare code 1004?

Cloudflare error 1004 indicates that Cloudflare is unable to complete an action performed by the user. Users normally face this error while adding/editing DNS records in the Cloudflare DNS area. For instance, a typical error message looks like:

Cloudflare code 1004

This error could be triggered due to issues with the DNS records, conflicts with the Cloudflare proxy etc.

Let us now look at some possible reasons for the code and tips to fix them.

Error with the DNS records

The most common reason for the Cloudflare code 1004 is an error with the DNS record that the user is trying to add. For instance, while adding A record, ensure that you are adding the correct record without any unwanted spaces and characters. Common mistakes made with DNS record include:

  • While adding A record, verify the IP address of your origin server is correct, is not a Cloudflare IP address, and has not recently been changed by your hosting provider. Also, remove any blank spaces before and after the IP address.
  • While adding a CNAME record, ensure that it is pointing to a hostname. A CNAME record cannot point to an IP address. Instead, add an A record for the IP address and then use the corresponding A record for adding the CNAME record.
  • While entering the MX record, try to enter the records manually instead of copy-pasting them it may also copy hidden characters. Also, use the hostname of the mail server instead of the IP address.

Cloudflare proxy

Some of the DNS records require the Cloudflare proxy to be turned off.  Thus, it would be a good idea to try adding the records after turning off the Cloudflare proxy.

To turn off the Cloudflare proxy, we just need to toggle the cloud icon from orange to grey.

Cloudflare code 1004

Invalid TTL value

Another major reason for the code 1004 is invalid TTL value. Cloudflare recommends using the TTL value between 120 and 2,147,483,647. However, users have a tendency to limit it to a much lower value to reduce the DNS propagation time. This in terms may lead to the DNS validation limit.

If you are not sure about the exact TTL value to be used, a suggested method is to set the TTL value to 1 to set the TTL value to automatic.

Browser Cache

At times this error could be a glitch caused by browser cache. Clearing the browser cache or re-login to the Cloudflare portal from an incognito window helps to overcome this error. Also, there is a known issue in editing Cloudflare DNS records using mobile versions. Thus it would be a good idea to switch to a desktop browser.

[Need assistance to fix Cloudflare errors? We’ll help you.]

Conclusion

In short, Cloudflare code 1004 is triggered while adding DNS records. This is primarily due to invalid format of the records or hindrance caused by Cloudflare proxy. Today we discussed some tips that our Support Engineers follow to fix the error message.

The post Tips to fix cloudflare code 1004 appeared first on Bobcares.

I have a Host rule in the || format that Cloudflare Companion expects and it still throws a 1004 error when encountering my root domain. Is it possible that the code can’t parse the root domain because it doesn’t have a subdomain?

My rule:

- "traefik.http.routers.organizr-rtr.rule=HostHeader(`organizr.$DOMAINNAME`) || HostHeader(`www.$DOMAINNAME`) || HostHeader(`$DOMAINNAME`)"

First two are parsed fine, the last one throws a 1004 error.

EDIT: I enabled debug logs and I think I see something that might cause an issue?

2020-09-20T06:40:40.796794552Z [info] Found Container ID: dcb28d022a374612478c77dac64fc54be3c100a83a32705acd5730a2eb01828a with Multi-Hostname example.com
2020-09-20T06:40:40.798406121Z 2020-09-20 01:40:40,796 - Python Cloudflare API v4 - DEBUG - Call: emulated curl command ...
2020-09-20T06:40:40.798546486Z        curl -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?name=example.com" 
2020-09-20T06:40:40.798641955Z             -H "User-Agent: python-cloudflare/2.8.13/python-requests/2.24.0/python/3.8.5" 
2020-09-20T06:40:40.798674038Z             -H "Content-Type: application/json" 
2020-09-20T06:40:40.798741903Z             -H "Authorization: REDACTED" 
2020-09-20T06:40:40.934313932Z 2020-09-20 01:40:40,933 - Python Cloudflare API v4 - DEBUG - Response: 200, application/json, b'{"result":[{"id":"$RECORD_ID","zone_id":"$ZONE_ID","zone_name":"example.com","name":"example.com","type":"A","content":"98.253.43.26","proxiable":true,"proxied":true,"ttl":1,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"created_on":"2020-09-20T06:15:17.720944Z","modified_on":"2020-09-20T06:15:17.720944Z"},{"id":"$RECORD_ID2","zone_id":"$ZONE_ID","zone_name":"example.com","name":"example.com","type":"TXT","content":"v=spf1 mx ~all","proxiable":false,"proxied":false,"ttl":1,"locked":false,"meta":{"auto_added":false,"managed_by_apps":false,"managed_by_argo_tunnel":false,"source":"primary"},"created_on":"2020-08-18T22:14:26.696523Z","modified_on":"2020-08-18T22:14:26.696523Z"}],"success":true,"errors":[],"messages":[],"result_info":{"page":1,"per_page":20,"count":2,"total_count":2,"total_pages":1}}'
2020-09-20T06:40:40.935163622Z 2020-09-20 01:40:40,934 - Python Cloudflare API v4 - DEBUG - Response: [{'id': '$RECORD_ID', 'zone_id': '$ZONE_ID', 'zone_name': 'example.com', 'name': 'example.com', 'type': 'A', 'content': '98.253.43.26', 'proxiable': True, 'proxied': True, 'ttl': 1, 'locked': False, 'meta': {'auto_added': False, 'managed_by_apps': False, 'managed_by_argo_tunnel': False, 'source': 'primary'}, 'created_on': '2020-09-20T06:15:17.720944Z', 'modified_on': '2020-09-20T06:15:17.720944Z'}, {'id': '$RECORD_ID2', 'zone_id': '$ZONE_ID', 'zone_name': 'example.com', 'name': 'example.com', 'type': 'TXT', 'content': 'v=spf1 mx ~all', 'proxiable': False, 'proxied': False, 'ttl': 1, 'locked': False, 'meta': {'auto_added': False, 'managed_by_apps': False, 'managed_by_argo_tunnel': False, 'source': 'primary'}, 'created_on': '2020-08-18T22:14:26.696523Z', 'modified_on': '2020-08-18T22:14:26.696523Z'}]
2020-09-20T06:40:40.936173731Z 2020-09-20 01:40:40,935 - Python Cloudflare API v4 - DEBUG - Call: emulated curl command ...
2020-09-20T06:40:40.936320502Z        curl -X POST "https://api.cloudflare.com/client/v4/zones/$ZONE/dns_records" 
2020-09-20T06:40:40.936356648Z             -H "User-Agent: python-cloudflare/2.8.13/python-requests/2.24.0/python/3.8.5" 
2020-09-20T06:40:40.936388210Z             -H "Content-Type: application/json" 
2020-09-20T06:40:40.936418679Z             -H "Authorization: REDACTED" 
2020-09-20T06:40:40.936448263Z             --data '{'type': 'CNAME', 'name': 'example.com', 'content': 'example.com', 'ttl': '1', 'proxied': True}' 
2020-09-20T06:40:41.110646948Z 2020-09-20 01:40:41,109 - Python Cloudflare API v4 - DEBUG - Response: 400, application/json, b'{"result":null,"success":false,"errors":[{"code":1004,"message":"DNS Validation Error","error_chain":[{"code":9039,"message":"CNAME content cannot reference itself"}]}],"messages":[]}'
2020-09-20T06:40:41.111994349Z 2020-09-20 01:40:41,110 - Python Cloudflare API v4 - DEBUG - Response: error 9039 CNAME content cannot reference itself - chain
2020-09-20T06:40:41.113061853Z 2020-09-20 01:40:41,111 - Python Cloudflare API v4 - DEBUG - Response: error 1004 DNS Validation Error
2020-09-20T06:40:41.113257374Z ** example.com - 1004 DNS Validation Error

The curl is trying to set a CNAME record for example.com pointing to example.com. I think that’s why the errors are saying that CNAME can’t reference itself.

Probably Cloudflare Companion should just ignore any parsed hostname that is an exact match for the TARGET_DOMAIN environment variable.

EDIT 2: I got rid of the error by changing TARGET_DOMAIN=$DOMAIN to TARGET_DOMAIN=ddns.$DOMAIN. Now when it tries to create a CNAME for example.com it will point to ddns.example.com so Cloudflare won’t mind. But probably the container should still have a contingency for when TARGET_DOMAIN is equal to the CNAME name. If this contingency isn’t put in place then it will cause issues with #13, since ddns will now need to be whitelisted and ignored somehow.

DNS Validation Error (Code 1004) CNAME content cannot be an IP (Code 9040)

You are getting this error because you added your i.p address in the place of your name in Cloudflare. Before I start explaining how we can fix the error “DNS Validation Error (Code: 1004): CNAME content cannot be an IP (Code: 9040) ” we should first know

Gomahamaya ads banner

What is CNAME?

CNAME – You can call CNAME a Canonical Name which is a kind of DNS that can be used to map domains. It’s a part of the main domain. It looks like a subdomain but it can’t be a subdomain because the subdomain is another domain but CNAME is part of the main domain which can be used to store data of the main domain or can be accessed as the main domain.

You may also be interested in FOMO Plugins, email marketing service, and Lead generation Plugins 

semrush Free trail banner

Solution 

Subdomain or any domain needs an i.p address which helps to connect between hosting and domain/subdomain. But when you used a CNAME as I have already explained to you cname records are the part of main domain. So for CNAME we used the alias of example.com, for example, I want to create a CNAME ( CDN ) for my domain gomahamaya.com (www not included) then I will point my CNAME CDN to an alias of gomahamaya then final real will be cdn.gomahamaya.com.

Now I have used the wrong way to add cname record of your website – I chose TYPE as CNAME, NAME, and Now VALUE my IP address —– CNAME doesn’t point to an IP

wrong way of writing cname record

And what is the correct way to add CNAME –  In TYPE You should choose CNAME and In NAME you need to write your

kwfinder banner

subdomain extension like CDN. In Value You should write your main domain name like gomahamaya.com. Now click on add record.

correct way to write cname

And Now bingo no more DNS Validation Error (Code: 1004): CNAME content cannot be an IP (Code: 9040).

Fastcomet banner
Gomahamaya ads banner

Author: Rahul Sahu

Hii all! I am Rahul. I love to design optimized and secure website. I am also a full-time Youtuber and blogger whereby I create content to help the non-technical audience.

Recommend Projects

  • React photo

    React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo

    Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo

    Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo

    TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo

    Django

    The Web framework for perfectionists with deadlines.

  • Laravel photo

    Laravel

    A PHP framework for web artisans

  • D3 photo

    D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Visualization

    Some thing interesting about visualization, use data art

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo

    Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo

    Microsoft

    Open source projects and samples from Microsoft.

  • Google photo

    Google

    Google ❤️ Open Source for everyone.

  • Alibaba photo

    Alibaba

    Alibaba Open Source for everyone

  • D3 photo

    D3

    Data-Driven Documents codes.

  • Tencent photo

    Tencent

    China tencent open source team.

Понравилась статья? Поделить с друзьями:
  • Dns probe finished nxdomain как исправить на виндовс 10
  • Dns probe finished nxdomain как исправить windows 10 pro x64
  • Dns probe finished nxdomain как исправить ubuntu
  • Dns probe finished nxdomain error
  • Dns probe finished no internet как исправить на компьютере