Spring RestTemplate needs header UserAgent

Hi Squidex Team,

we have a Java Sevice which do the calls to Squidex API via REST. This doesn’t work out of the box. After debugging the Code we see that user agent header is needed.

Do you know this problem and can you resolve it? As workaround we add this header to the request.

Best regards,
Jens Lehmann

Hi Jens,

who needs the user agent? Squidex API?

Hi Sebastian,

Cloudflare I think.

Best regards,
Jens

I just tested it with fiddler:

GET https://cloud.squidex.io/api/content/squidex-website/blog?$top=10 HTTP/1.1
Authorization: Bearer ...
Host: cloud.squidex.io

Hi Sebastian,

with Chrome RestClient and CURL we have also no problems, but in our Apllication using Spring RestTemplate.

Best regards,
Jens

Can you debug it with Fiddler and send me the request via DM?

We had the same issue with RestTemplate, so we decided it’s a bit funny, but changed the user-agent string to “not java” and everything works since then. So, if you put a header like this:

curl -H "User-Agent: Java/1.8.0_131" ...

you will get in response:

...
<title>Access denied | cloud.squidex.io used Cloudflare to restrict access</title>
...
<div class="cf-section cf-wrapper">
        <div class="cf-columns two">
          <div class="cf-column">
            <h2 data-translate="what_happened">What happened?</h2>
            <p>The owner of this website (cloud.squidex.io) has banned your access based on your browser's signature (49572abeec7a8c7c-ua21).</p>
          </div>


        </div>
...
2 Likes

Interesting, I have not blocked it by myself.

I have found the setting in cloudflare. It seems that Java is used a lot by spammers :wink:

Cool, that means we can finally remove our custom User-Agent: not java :+1: