JeffreyCA/Apollo-ImprovedCustomApi

Custom User Agent change breaks searching in multireddits

Closed this issue · 2 comments

Custom user agent change to generic one last week works great except for searching in Multireddits
For example: User agent used by apollo currently

curl -i -s -k -X $'GET' \ -H $'Host: oauth.reddit.com' -H $'Accept: */*' -H $'Accept-Encoding: gzip, deflate' -H $'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1' -H $'Accept-Language: en-IN;q=1, hi-IN;q=0.9, hi-Latn-IN;q=0.8, kn-IN;q=0.7' -H $'Authorization: bearer <REDACTED>' \ $'https://oauth.reddit.com/r/AppleWatch+macbook+osx+appletv+iOSBeta+CarPlay+hackintosh+ipad+tvOSBeta+iosgaming+watchOSBeta+swift+apple+VintageApple+MacOSBeta+ipod+mac+shortcuts+AppleMusic+HomeKit+watchos+applehelp+beatsbydre+macsetups+bootcamp+macbookpro+AppleWhatShouldIBuy+ios+iphone+macapps+airpods+tvPlus+AppHookup+macgaming+macsysadmin+AppleCard+MacOS/search.json?api_type=json&limit=25&q=iOS%20&raw_json=1&restrict_sr=true&sort=relevance&t=all'

Gives
HTTP/2 302 Found Retry-After: 0 Location: https://www.reddit.com/ Accept-Ranges: bytes Date: Thu, 01 Aug 2024 16:21:08 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 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} Content-Length: 0

But only changing User Agent and nothing else in the original request

curl -i -s -k -X $'GET' \ -H $'Host: oauth.reddit.com' -H $'Accept: */*' -H $'Accept-Encoding: gzip, deflate' -H $'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36' -H $'Accept-Language: en-IN;q=1, hi-IN;q=0.9, hi-Latn-IN;q=0.8, kn-IN;q=0.7' -H $'Authorization: bearer <REDACTED>' \ $'https://oauth.reddit.com/r/AppleWatch+macbook+osx+appletv+iOSBeta+CarPlay+hackintosh+ipad+tvOSBeta+iosgaming+watchOSBeta+swift+apple+VintageApple+MacOSBeta+ipod+mac+shortcuts+AppleMusic+HomeKit+watchos+applehelp+beatsbydre+macsetups+bootcamp+macbookpro+AppleWhatShouldIBuy+ios+iphone+macapps+airpods+tvPlus+AppHookup+macgaming+macsysadmin+AppleCard+MacOS/search.json?api_type=json&limit=25&q=iOS%20&raw_json=1&restrict_sr=true&sort=relevance&t=all'
now gives
HTTP/2 200 OK X-Ua-Compatible: IE=edge Content-Type: application/json; charset=UTF-8 Expires: -1 Cache-Control: private, s-maxage=0, max-age=0, must-revalidate, no-store X-Ratelimit-Used: 181 X-Ratelimit-Remaining: 819.0 X-Ratelimit-Reset: 91 Accept-Ranges: bytes Date: Thu, 01 Aug 2024 16:38:29 GMT Via: 1.1 varnish Vary: accept-encoding Strict-Transport-Security: max-age=31536000; includeSubdomains X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-Xss-Protection: 1; mode=block Set-Cookie: <REDACTED> Domain=reddit.com; Max-Age=63071999; Path=/; expires=Sat, 01-Aug-2026 16:38:28 GMT; secure; SameSite=None; Secure Set-Cookie: session_tracker=<REDACTED> Domain=reddit.com; Max-Age=7199; Path=/; expires=Thu, 01-Aug-2024 18:38:28 GMT; secure; SameSite=None; Secure Set-Cookie: csv=2; Max-Age=63072000; Domain=.reddit.com; Path=/; Secure; SameSite=None Set-Cookie: edgebucket=<REDACTED>; Domain=reddit.com; Max-Age=63071999; Path=/; 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} Content-Length: 114616

User agent used in paradoxally's Tweak also works great. https://github.com/paradoxally/Apollo-User-Agent-Fix/blob/main/Tweak.x

        [mutableRequest setValue:@"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36" forHTTPHeaderField:@"User-Agent"];

Thanks for the report, this is fixed in v1.1.2