typicode / jsonplaceholder

A simple online fake REST API server
https://jsonplaceholder.typicode.com
MIT License
5.05k stars 582 forks source link

cloudflare is not allowing to access via rest assured #195

Closed vladgogit closed 1 year ago

vladgogit commented 1 year ago

Hi! The problem is that I used https://jsonplaceholder.typicode.com/ for some demo rest assured tests and now I can't access it because of cloudflare block. HTTP/1.1 403 Forbidden Enable JavaScript and cookies to continue I've tried to add few headers to make it less or more "fake" but nothing works so far. Any suggestions? Or maybe it's a problem on your end?

benparsell commented 1 year ago

Also facing this issue – tried changing a 'user-agent' to no avail

cdtkrk commented 1 year ago

I've got response like this:

<!DOCTYPE html>
<html lang="en-US">
<head>
    <title>Just a moment...</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge">
    <meta name="robots" content="noindex,nofollow">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <link href="/cdn-cgi/styles/challenges.css" rel="stylesheet">

</head>
<body class="no-js">
    <div class="main-wrapper" role="main">
    <div class="main-content">
        <noscript>
            <div id="challenge-error-title">
                <div class="h2">
                    <span class="icon-wrapper">
                        <div class="heading-icon warning-icon"></div>
                    </span>
                    <span id="challenge-error-text">
                        Enable JavaScript and cookies to continue
                    </span>
                </div>
            </div>
        </noscript>
        <div id="trk_jschal_js" style="display:none;background-image:url('/cdn-cgi/images/trace/managed/nojs/transparent.gif?ray=7de308024ad0ca1f')"></div>
        <form id="challenge-form" action="/users?__cf_chl_f_tk=d2C9218lVT.qEbedmhuSOJ2.zOaWJydGETM3UhIofSQ-1687924915-0-gaNycGzNCmU" method="POST" enctype="application/x-www-form-urlencoded">
            <input type="hidden" name="md" value="Wde5C0km9abyfYaI9FcJUin2bSWYu6Dti6ZkWIzS994-1687924915-0-Abs3m6gJr4MRJWx-hfOkUjg6mNd9NwriRsK9Po2aX6nfbFXC2tUTZY8C4zp4oiKUjGABTAOEPYUI2ABktaYHSvTTUOpRSxJqXeoYktsh3A8WJT4ycY-eS_C0idNUh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2L0RhrnYybL_q3o0QW8Gj-qO4CYY8iu_5A9EflOH8qIT5CT0w14hwabDGfBVSSpq3lSzv1WOC514n-g05SNEKkQ43Ww_Ol4LMGOUU5rSoUBHG_D9PHgqaDWtQAMv890Ys_WpeDYK6bYbnBaRWtzSoyDi2k7KHDXDBExXB_85_Jiae5oHNC_G5vZXQXa4lACTgvaZO3WZcfkGqEPHVKCKMu4vN4WVF_daEB4K8JOdyUK3Gqqla1g8ZlfisqFWbO1eSGVPh9pGgswGqo8-R0ce9PXY2BFM47ER60drL-Mu3">
        </form>
    </div>
</div>
<script>
    (function(){
        window._cf_chl_opt={
            cvId: '2',
            cZone: 'jsonplaceholder.typicode.com',
            cType: 'managed',
            cNounce: '37977',
            cRay: '7de308024ad0ca1f',
            cHash: '502c8a0fd21d0cf',
            cUPMDTk: "\/users?__cf_chl_tk=d2C9218lVT.qEbedmhuSOJ2.zOaWJydGETM3UhIofSQ-1687924915-0-gaNycGzNCmU",
            cFPWv: 'g',
            cTTimeMs: '1000',
            cMTimeMs: '0',
            cTplV: 5,
            cTplB: 'cf',
            cK: "",
            cRq: {
                ru: 'aHR0cHM6Ly9qc29ucGxhY2Vob2xkZXIudHlwaWNvZGUuY29tL3VzZXJz',
                ra: 'bm9kZS1mZXRjaC8xLjAgKCtodHRwczovL2dpdGh1Yi5jb20vYml0aW5uL25vZGUtZmV0Y2gp',
                rm: 'R0VU',
                d: 'DfdyjS25mFlNr/HLCOxsMAxlt+ltChhkGiuZuyCv2jPLGHY20pJHEf4A/04XaqudU7ArN0Ni3Lkq1Au55uR1ZuQPOo/EEopMD4hM8TONkZQhCIgtmd5qdEbAKflxu1xuabnIK0kasBV7/mrCjoCot+6mLbNwBTZHByI6P6i641M/gSMO5I4rrGJUM5pwMkunwmT/jVYDH3P8oo58SgHerQ05noEZP3RKcDS8j9rICklZL0BTRFgV/egoMUp8HfIJxk48/luDwVyexBX3gFjDwrcrbIu1zQfHtDdP/TV7Ldv92ufKSgODZ9sDHqIRqe6K7LG0SaiR07svWnYThOBaheAG9CAtQ+PETA+dGLXL/0NyLiJ6uLif1rzDZCXpeCon/JejVf2oo62b7scCc7xIq3ol26IfxwJEq7BqoCiMCNBOcV4XsCM099S+/yXrvhFrhobgEU+93/Hr5UvTPUxu/PGRbrZIVBX6WX15p5j/XpHdJ9ugYf1aaXjRUP3kzBefZxx/px3lxoA+/kjkId5VBsqjtDHCgIzOufpcnkH2DnOvB+zZrC7Nco0TR86DWubi',
                t: 'MTY4NzkyNDkxNS41NzQwMDA=',
                cT: Math.floor(Date.now() / 1000),
                m: 'HlFBdvwNXdVfqB8E5aJSeR0W5l8ZF7jf4O+vX+or46g=',
                i1: 'lSnaTvjh8g3HbGFi5YX0Zw==',
                i2: 'qbnNarXjWV2JQlQkTacoJQ==',
                zh: 'aRTrCUXBzVClYQkPLDK7Jzhnhq8KH9QXbX2+1fhJJAo=',
                uh: 'o3n6xEt35XQSPgkMHltSudNiWY3D18ZEWvIVxqHkP+4=',
                hh: 'bij/FTwP5I8BSwgg1oW6LkxxhBfLOff7motYv0y3gmw=',
            }
        };
        var trkjs = document.createElement('img');
        trkjs.setAttribute('src', '/cdn-cgi/images/trace/managed/js/transparent.gif?ray=7de308024ad0ca1f');
        trkjs.setAttribute('alt', '');
        trkjs.setAttribute('style', 'display: none');
        document.body.appendChild(trkjs);
        var cpo = document.createElement('script');
        cpo.src = '/cdn-cgi/challenge-platform/h/g/orchestrate/managed/v1?ray=7de308024ad0ca1f';
        window._cf_chl_opt.cOgUHash = location.hash === '' && location.href.indexOf('#') !== -1 ? '#' : location.hash;
        window._cf_chl_opt.cOgUQuery = location.search === '' && location.href.slice(0, location.href.length - window._cf_chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;
        if (window.history && window.history.replaceState) {
            var ogU = location.pathname + window._cf_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;
            history.replaceState(null, null, "\/users?__cf_chl_rt_tk=d2C9218lVT.qEbedmhuSOJ2.zOaWJydGETM3UhIofSQ-1687924915-0-gaNycGzNCmU" + window._cf_chl_opt.cOgUHash);
            cpo.onload = function() {
                history.replaceState(null, null, ogU);
            };
        }
        document.getElementsByTagName('head')[0].appendChild(cpo);
    }());
</script>

</body>
</html>
JavenJin commented 1 year ago

I also encountered this problem.

It returned to me “403 Forbidden Error. The server understood the request but refuses to authorize it.”. When I use the web access it is fine.

MykolaGolubyev commented 1 year ago

Same here. It works on my local machine but fails from GitHub actions. Breaks WebTau build now. Considering changing examples, but it may take some time.

typicode commented 1 year ago

Sorry about that, sometimes the site gets under attack. I've relaxed rules, let me know if it's better?

vladgogit commented 1 year ago

Sorry about that, sometimes the site gets under attack. I've relaxed rules, let me know if it's better?

works for me, thanks!

JavenJin commented 1 year ago

Sorry about that, sometimes the site gets under attack. I've relaxed rules, let me know if it's better?

works for me, thanks!

cdtkrk commented 1 year ago

Sorry about that, sometimes the site gets under attack. I've relaxed rules, let me know if it's better?

Also works for me ! Thanks a lot!