-
-
Save a9udn9u/85e0c8e863db85c5b62320766bd7b2e9 to your computer and use it in GitHub Desktop.
| import json | |
| import re | |
| from mitmproxy import http | |
| url_pattern = re.compile(r"^.*\.nvidiagrid.net/v2/session") | |
| user_agent_pattern = re.compile(r"(Mozilla\/[\d\.]+) \(.+?\)") | |
| def request(flow: http.HTTPFlow) -> None: | |
| # Check if the request matches the regex pattern | |
| if url_pattern.match(flow.request.pretty_url): | |
| flow.request.headers['nv-device-os'] = 'WINDOWS' | |
| flow.request.headers['sec-ch-ua-platform'] = '"WINDOWS"' | |
| flow.request.headers['sec-ch-ua-platform-version'] = '14.0.0' | |
| if "user-agent" in flow.request.headers: | |
| flow.request.headers["user-agent"] = user_agent_pattern.sub( | |
| r'\1 (Windows NT 10.0; Win64; x64)', | |
| flow.request.headers["user-agent"]) | |
| if flow.request.headers.get("content-type") == "application/json": | |
| try: | |
| body = json.loads(flow.request.content) | |
| if body.get("sessionRequestData", {}).get("clientRequestMonitorSettings", None) is not None: | |
| body["sessionRequestData"]["clientRequestMonitorSettings"] = [ | |
| { | |
| "heightInPixels": 1440, | |
| "framesPerSecond": 120, | |
| "widthInPixels": 2560 | |
| } | |
| ] | |
| flow.request.content = json.dumps(body).encode("utf-8") | |
| except json.JSONDecodeError: | |
| pass | |
| function FindProxyForURL(url, host) { | |
| var proxy = "PROXY <your proxy server IP>:<your proxy server port>"; | |
| if (/^https:\/\/.+\.nvidiagrid.net/.test(url)) { | |
| // Should only proxy /v2/session, but the URL path is removed by Chrome | |
| return proxy; | |
| } | |
| return "DIRECT"; | |
| } |
It's normal for most requests to not match the criteria, only one specific request at the start of the gaming sessions will be modified.
@kubrickfr I feel like this is not really explained well anywhere. I was looking in the settings of GeForce Now, and it consistently showed 60 FPS and 1200p as max.
I have been trying this for so long.
@SebastianFalborg
Settings:

Again, do check that you have video acceleration properly enable in chrome
@kubrickfr Sorry I was not clear. I understand how it works now.
I am getting 1440p 120fps in Witcher 3, and everything works.
But I was just frustrated because I have been trying absolutely everything to get the settings to show 1440p.
I don't feel like it was very well explained that it would look wrong in the settings, but correct in the game.
https://chromewebstore.google.com/detail/modify-http-header/pefdbdgalcpplfidblkgpjlpggfepipd
Also works... .*\.(geforcenow\.com)|(nvidia\.com)|(nvidiagrid\.net)|(geforce\.com)

This leads to a playable 1440p at 45mbps... at 75mbps the input latency is rediculously high. On the same machine with wIndows, I can comfortably run 100mbps, strange as the fast.com loaded latency speed tests are very close between OSs. I tried Proton unsuccessfully.
@FossPrime the reason why you're seeing high input latency is most likely because you don't have hardware acceleration.
See my previous comments: this one, that one
Nice that we don't need mitmproxy any more!
https://chromewebstore.google.com/detail/modify-http-header/pefdbdgalcpplfidblkgpjlpggfepipd
Also works...
.*\.(geforcenow\.com)|(nvidia\.com)|(nvidiagrid\.net)|(geforce\.com)This leads to a playable 1440p at 45mbps... at 75mbps the input latency is rediculously high. On the same machine with wIndows, I can comfortably run 100mbps, strange as the fast.com loaded latency speed tests are very close between OSs. I tried Proton unsuccessfully.
Any chance you could share more info on what you put on the headers? I've added "Chrome OS" & "CHROMEOS" but unable to identify the others but t;s not currently working thanks :)


This is my GET to https://prod.cloudmatchbeta.nvidiagrid.net/v2/session
GET /v2/session HTTP/1.1
Host: prod.cloudmatchbeta.nvidiagrid.net
Connection: keep-alive
nv-client-type: BROWSER
authorization: ....
sec-ch-ua-platform: "WINDOWS"
x-device-id: 5cb52e94-c699-43bd-8e32-6d018420c64d
sec-ch-ua: "Not)A;Brand";v="8", "Chromium";v="138", "Google Chrome";v="138"
sec-ch-ua-mobile: ?0
traceparent: 00-12da1eb766e07aabde28b923189007e8-c8cf635b03a8dcd1-01
nv-client-id: ec7e38d4-03af-4b58-b131-cfb0495903ab
nv-device-type: DESKTOP
content-type: application/json
nv-device-os: WINDOWS
nv-device-model: UNKNOWN
nv-client-streamer: WEBRTC
nv-browser-type: CHROME
nv-client-version: 2.0.75.146
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36
nv-device-make: UNKNOWN
Accept: /
Origin: https://play.geforcenow.com
Sec-Fetch-Site: cross-site
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Accept-Encoding: gzip, deflate, br, zstd
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
sec-ch-ua-platform-version: 14.0.0
And this is the response
HTTP/1.1 200 OK
cache-control: private
content-type: application/json
server: Microsoft-IIS/10.0
x-aspnet-version: 4.0.30319
x-powered-by: ASP.NET
access-control-allow-origin: *
access-control-allow-headers: Content-Type, Authorization, Connection, User-Agent
access-control-allow-methods: GET, POST, PUT, DELETE, OPTIONS
date: Thu, 26 Jun 2025 08:45:58 GMT
content-length: 199
set-cookie: SERVERID=pm10_192_13_22; path=/
{"sessions":[],"requestStatus":{"statusCode":1,"statusDescription":"SUCCESS_STATUS","unifiedErrorCode":0,"requestId":"59d5bc54-247e-4a6a-8531-1ec3c3b41e25","serverId":"NP-SOF-02","countryCode":null}}
I feel like I have tried everything at this point. I am not sure what is wrong here.