As of yesterday, getting Error 302 with Error 54113 in body

Reddit API

As of yesterday, I'm getting the following response for my requests to r/subreddit/new

HTTP/1.1 302 Found
Connection: close
Content-Length: 405
Retry-After: 0
Set-Cookie: rdt=67bd19b33b3fxxxxx76c62a9a1de6e
location: [r/subreddit](/r/subreddit)/new?rdt=50895
Content-Type: text/html; charset=utf-8
Accept-Ranges: bytes
Date: Fri, 11 Aug 2023 15:01:47 GMT
Via: 1.1 varnish
Strict-Transport-Security: max-age=31536000; includeSubdomains
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Set-Cookie: edgebucket=ovItaxxxxxcvzQHO; Domain=reddit.com; Max-Age=63071999; Path=/;  secure
Cache-Control: private, max-age=3600
Server: snooserv
Report-To: {"group": "w3-reporting-nel", "max_age": 14400, "include_subdomains": true,  "endpoints": [{ "url": "https://w3-reporting-nel.reddit.com/reports" }]}, {"group": "w3-reporting", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting.reddit.com/reports" }]}, {"group": "w3-reporting-csp", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting-csp.reddit.com/reports" }]}
NEL: {"report_to": "w3-reporting-nel", "max_age": 14400, "include_subdomains": false, "success_fraction": 1.0, "failure_fraction": 1.0}


<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>302 Found</title>
  </head>
  <body>
    <h1>Error 302 Found</h1>
    <p>Found</p>
    <h3>Error 54113</h3>
    <p>Details: cache-bma1661-BMA 1691766108 1890091604</p>
    <hr>
    <p>Varnish cache server</p>
  </body>
</html>

No OAuth used and this is for a single request, which should not hit any rate limit. User-Agent is custom, according to guidelines.

Any clue what is going on?

Posted Aug 11, 2023, 3:11 PM UTC

12
notifications_appAlerts for Reddit Developer•

302 is a redirect, not really an error. It looks like it's trying to redirect you from https://api.reddit.com/r/subreddit/new to https://api.reddit.com/r/subreddit/new?rdt=50895 , and your code isn't following the redirect, so you're getting stuck at the 302.

I'm not sure which language you're using, but there is often a parameter you can use to follow redirects automatically. Just Google "[your language] follow URL redirects".

1
methomanOP•

I did follow it and it just leads me to a HTML page, not actual json which is to be expected.

You basically get the web version of whatever sub you requested.

Try yourself, on a subreddit of your choice, without being logged in.

Up until two days ago, it still gave json, as you would expect from the API.

1
notifications_appAlerts for Reddit Developer•

If you post your code (with things like client secret redacted), I'd be happy to play with it and see what I can figure out.

1
methomanOP•

I'd love to.

$ wget -S -O /dev/null -o - https://api.reddit.com/r/redditdev/new
--2023-08-12 18:31:14--  https://api.reddit.com/r/redditdev/new
Resolving api.reddit.com (api.reddit.com)... 151.101.193.140, 151.101.1.140, 151.101.65.140, ...
Connecting to api.reddit.com (api.reddit.com)|151.101.193.140|:443... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 302 Found
  Connection: close
  Content-Length: 405
  Retry-After: 0
  Set-Cookie: rdt=1033f2b6f29ae7d2cfa1075b6745301c
  location: [r/redditdev](/r/redditdev)/new?rdt=40634
  Content-Type: text/html; charset=utf-8
  Accept-Ranges: bytes
  Date: Sat, 12 Aug 2023 22:31:17 GMT
  Via: 1.1 varnish
  Strict-Transport-Security: max-age=31536000; includeSubdomains
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block
  Set-Cookie: edgebucket=jtJ8TEJ0jpaRPZt9jm; Domain=reddit.com; Max-Age=63071999; Path=/;  secure
  Cache-Control: private, max-age=3600
  Server: snooserv
  Report-To: {"group": "w3-reporting-nel", "max_age": 14400, "include_subdomains": true,  "endpoints": [{ "url": "https://w3-reporting-nel.reddit.com/reports" }]}, {"group": "w3-reporting", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting.reddit.com/reports" }]}, {"group": "w3-reporting-csp", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting-csp.reddit.com/reports" }]}
  NEL: {"report_to": "w3-reporting-nel", "max_age": 14400, "include_subdomains": false, "success_fraction": 1.0, "failure_fraction": 1.0}
Location: [r/redditdev](/r/redditdev)/new?rdt=40634 [following]
--2023-08-12 18:31:17--  https://api.reddit.com/r/redditdev/new?rdt=40634
Connecting to api.reddit.com (api.reddit.com)|151.101.193.140|:443... connected.
HTTP request sent, awaiting response...
  HTTP/1.1 301 Moved Permanently
  Connection: keep-alive
  Content-Length: 65
  cache-control: private, s-maxage=1, max-age=1, must-revalidate
  content-security-policy: child-src 'self' blob: accounts.google.com;connect-src 'self' events.redditmedia.com o418887.ingest.sentry.io *.redd.it *.reddit.com vimeo.com alb.reddit.com accounts.google.com/gsi/ w3-reporting.reddit.com reddit-uploaded-media.s3-accelerate.amazonaws.com reddit-uploaded-video.s3-accelerate.amazonaws.com wss://*.wss.redditmedia.com wss://gql-realtime.reddit.com api.giphy.com js.stripe.com;default-src 'self';font-src 'self' data:;form-action 'none';frame-ancestors 'self' *.reddit.com *.snooguts.net;frame-src 'self' www.reddit.com www.youtube-nocookie.com player.vimeo.com *.redditmedia.com cdn.embedly.com redgifs.com www.redgifs.com accounts.google.com/gsi/ www.google.com/recaptcha/ recaptcha.google.com/recaptcha/ js.stripe.com hooks.stripe.com;img-src 'self' data: blob: https:;manifest-src 'self' www.redditstatic.com;media-src 'self' blob: data: *.redd.it www.redditstatic.com;object-src 'none';script-src 'self' 'unsafe-inline' 'unsafe-eval' www.redditstatic.com js.stripe.com 'nonce-451w724SdwySGYiP5NmmeQ==';style-src 'self' 'unsafe-inline' www.redditstatic.com *.reddit.com accounts.google.com/gsi/style;style-src-attr 'unsafe-inline';worker-src blob:;report-to csp;report-uri https://w3-reporting-csp.reddit.com/reports
  content-security-policy-report-only: object-src 'none';script-src 'nonce-451w724SdwySGYiP5NmmeQ==' 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https:;frame-ancestors 'self' *.reddit.com *.snooguts.net;base-uri 'self';report-to csp;report-uri https://w3-reporting-csp.reddit.com/reports
  content-type: text/html; charset=utf-8
  location: [r/redditdev](/r/redditdev)/new/
  x-is-wrs: false
  Accept-Ranges: bytes
  Date: Sat, 12 Aug 2023 22:31:18 GMT
  Via: 1.1 varnish
  Vary: Accept-Encoding,accept-language
  Strict-Transport-Security: max-age=31536000; includeSubdomains
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block
  Set-Cookie: loid=000000000hgrmbanfx.2.1691879478500.Z0FBQUFBQmsyQWcyM3Y1NGQ5UVVrSzlGZURzT3NJaDhEV2UybFN2aE9LeDFfY19UR2VMRDEtWDllM09Ic3IyMm9NaFdBSmtGbVZsdW14TVEwWDNmZHVPQ1JBOC1oelhRcmVhYzgyMjBxWWVaMGhLOU9XWU5FNGFTYWxoSFNNTjFlX01sWHRfYXVnVGM; path=/; expires=Mon, 11 Aug 2025 22:31:18 GMT; domain=.reddit.com; samesite=none; secure
  Set-Cookie: session_tracker=lmloombqaighqbpmre.0.1691879478505.Z0FBQUFBQmsyQWcyTWRFWVJnX0plSkVmWWw3NXBWejJoWTZkT2dBZU9weWR4QXFzOUoyN0M2REZWZ0Q1c0cybHhSZFFEMEd2TTZKYjlZYzI1el9wODVpWWg0NnM2aDd5N0VzQkJPRVhkXzhkNUl2YUt6V3IzbDdheTdiYVpQSV9ZWGttLWdnNDJMZjA; path=/; domain=.reddit.com; secure; SameSite=None; Secure
  Set-Cookie: csrf_token=bab236921dd7127cba29ac50b0b0eb06; path=/; domain=.reddit.com; samesite=strict; secure
  Set-Cookie: token_v2=xxx; Path=/; Domain=reddit.com; Expires=Tue, 12 Aug 2025 22:31:18 GMT; HttpOnly; Secure
  Set-Cookie: csv=2; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=None
  Server: snooserv
  Report-To: {"group": "w3-reporting-nel", "max_age": 14400, "include_subdomains": true,  "endpoints": [{ "url": "https://w3-reporting-nel.reddit.com/reports" }]}, {"group": "w3-reporting", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting.reddit.com/reports" }]}, {"group": "w3-reporting-csp", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting-csp.reddit.com/reports" }]}
  NEL: {"report_to": "w3-reporting-nel", "max_age": 14400, "include_subdomains": false, "success_fraction": 1.0, "failure_fraction": 1.0}
Location: [r/redditdev](/r/redditdev)/new/ [following]
--2023-08-12 18:31:18--  https://api.reddit.com/r/redditdev/new/
Reusing existing connection to api.reddit.com:443.
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Connection: keep-alive
  cache-control: private, s-maxage=1, max-age=1, must-revalidate
  content-security-policy: child-src 'self' blob: accounts.google.com;connect-src 'self' events.redditmedia.com o418887.ingest.sentry.io *.redd.it *.reddit.com vimeo.com alb.reddit.com accounts.google.com/gsi/ w3-reporting.reddit.com reddit-uploaded-media.s3-accelerate.amazonaws.com reddit-uploaded-video.s3-accelerate.amazonaws.com wss://*.wss.redditmedia.com wss://gql-realtime.reddit.com api.giphy.com js.stripe.com;default-src 'self';font-src 'self' data:;form-action 'none';frame-ancestors 'self' *.reddit.com *.snooguts.net;frame-src 'self' www.reddit.com www.youtube-nocookie.com player.vimeo.com *.redditmedia.com cdn.embedly.com redgifs.com www.redgifs.com accounts.google.com/gsi/ www.google.com/recaptcha/ recaptcha.google.com/recaptcha/ js.stripe.com hooks.stripe.com;img-src 'self' data: blob: https:;manifest-src 'self' www.redditstatic.com;media-src 'self' blob: data: *.redd.it www.redditstatic.com;object-src 'none';script-src 'self' 'unsafe-inline' 'unsafe-eval' www.redditstatic.com js.stripe.com 'nonce-KCBzFzXvroG/4jwzVD7xpw==';style-src 'self' 'unsafe-inline' www.redditstatic.com *.reddit.com accounts.google.com/gsi/style;style-src-attr 'unsafe-inline';worker-src blob:;report-to csp;report-uri https://w3-reporting-csp.reddit.com/reports
  content-security-policy-report-only: object-src 'none';script-src 'nonce-KCBzFzXvroG/4jwzVD7xpw==' 'unsafe-inline' 'unsafe-eval' 'strict-dynamic' https:;frame-ancestors 'self' *.reddit.com *.snooguts.net;base-uri 'self';report-to csp;report-uri https://w3-reporting-csp.reddit.com/reports
  content-type: text/html; charset=utf-8
  x-is-wrs: false
  Accept-Ranges: bytes
  Date: Sat, 12 Aug 2023 22:31:18 GMT
  Via: 1.1 varnish
  Vary: Accept-Encoding,accept-language
  Strict-Transport-Security: max-age=31536000; includeSubdomains
  X-Content-Type-Options: nosniff
  X-Frame-Options: SAMEORIGIN
  X-XSS-Protection: 1; mode=block
  Set-Cookie: session_tracker=lmloombqaighqbpmre.0.1691879478744.Z0FBQUFBQmsyQWcyaElNM1B5N3E4ajNSMWVvR3M2SWVUN2VKQUx0ZS16bHBCblEybmNDdTFhdnc4bGFxcEtuSTdkR0hUWm10Y1ItLVBMNUtCczBlZndLVjBiZTBmZXZKQmI3cnU2alIycnFyTUZPcXhFTDY5UTJYQldmd2QtWUVxdHQ5SEx6cF9YNzY; path=/; domain=.reddit.com; secure; SameSite=None; Secure
  Server: snooserv
  Report-To: {"group": "w3-reporting-nel", "max_age": 14400, "include_subdomains": true,  "endpoints": [{ "url": "https://w3-reporting-nel.reddit.com/reports" }]}, {"group": "w3-reporting", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting.reddit.com/reports" }]}, {"group": "w3-reporting-csp", "max_age": 14400, "include_subdomains": true, "endpoints": [{ "url": "https://w3-reporting-csp.reddit.com/reports" }]}
  NEL: {"report_to": "w3-reporting-nel", "max_age": 14400, "include_subdomains": false, "success_fraction": 1.0, "failure_fraction": 1.0}
  transfer-encoding: chunked
Length: unspecified [text/html]
Saving to: ‘/dev/null’

     0K .......... .......... .......... .......... ..........  402K
    50K .......... .......... .......... .......... ..........  973K
   100K .......... .......... .......... .......... ..........  785K
   150K .......... .......... .......... .......... .......... 1.91M
   200K .......... .......... .......... .......... ..........  843K
   250K .......... .......... .......... .......... ..........  960K
   300K .......... .......... .......... .......... .......... 1.70M
   350K .......... .......... .......... .......               1.00M=0.4s

2023-08-12 18:31:19 (877 KB/s) - ‘/dev/null’ saved [396512]

This used to work, up until a few days ago.

1
notifications_appAlerts for Reddit Developer•

How are you authorizing? I assume you're sending your client credentials somehow, since when I use your exact command from above I get a 403 (forbidden) not a 302 (moved). I know you said you're not using OAuth, but what are you using?

Also, if you're not using OAuth anyway, you could try getting the JSON directly, like you can in browser: https://reddit.com/r/redditdev/new.json

1
whyattretard•

Had the same error: had to add an api login (and collect the cookie) before requesting a token.

1