-
-
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"; | |
} |
For those wondering what to do with this stuff to get it working:
- Install
mitmproxy
per the docs at: https://docs.mitmproxy.org/stable/overview-installation/ - Run mitmproxy and use the py file above as a script, passed to mitmproxy using the
-s
argument, so something like:
mitmproxy -s geforce-now-resolution-interceptor.py
- Then, you need to set up the pac-script.js in your browser of choice. Edge is probably a good option here, as it's supported by Geforce Now. I used an addon call "Proxy Switcher and Manager" and it allows you to enter an inline PAC file, and just use the content of the pac-script.js for that.
- One issue you'll run into is TLS not working correctly because you need to install a trusted CA cert from mitmproxy.org. Download the cert and follow the instructions for your OS. Restart mitmproxy and your browser.
- Enjoy the higher resolutions in GFN
I'm adding my 2 cents here are as the info I found here required a lot of digging and installing proxy extensions that are trying to do things Chrome does on it's on perfectly fine. My reply is also buried in that thread:
If you run mitmproxy, it defaults to 127.0.0.1
and 8080
(mitmproxy --help
).
The instructions provided here are not the clear on what has to be accomplished. So you need to break it down.
- Configure
mitmproxy
to ensure you have TLS support.- Copy the resolution interceptor script and start
mitmproxy
with it:mitmproxy -s /path/to/geforce-now-resolution-interceptor.py
. Keep that console open, you want to see the traffic intercepted there to know that everything is proxied. - Make sure you start a completely new instance of chrome, if you see Opening in existing browser session., you already have a chrome opened and it won't take into consideration --proxy-server.
- Try to reach
http://mitm.it
again. It should show the TLS certificates instructions. Install the certificate and configure chrome to "Identify Websites": "Settings -> Privacy and security -> Security -> Manage certificates -> Authorities -> Import". - Once the certificate is allowed to "Identify Websites", check that
https://mitm.it
is loading without warning. - If you are here and it's working, you don't need
--proxy-server
or any other extensions to manage the proxy, you can continue with CLI flags as longs are you start a fresh chrome instance.
- Copy the resolution interceptor script and start
- Configure Chrome to use the pac script
- Copy the pac script and note the path
- Update the
pac-script.js
script with your proxy address (default: 127.0.0.1:8080) - Start
mitmproxy
if you haven't - Start chrome with the
--proxy-pac-url
flag. YOU CANNOT PASS A FILEPATH DIRECTLY:google-chrome-stable --proxy-pac-url='data:application/x-javascript-config;base64,'$(base64 -w0 /path/to/pac-script.js)
- When going to the GNF game webpage, you should start seeing traffic in the
mitmproxy
console.
That did the trick for me. Got some 1440p gaming.
I dont see option to accept certificate.
EDIT:
Does it still work properly for you? I was able to accept the certificate but the resolution maxed out at 1920x1080
I'm adding my 2 cents here are as the info I found here required a lot of digging and installing proxy extensions that are trying to do things Chrome does on it's on perfectly fine. My reply is also buried in that thread:
If you run mitmproxy, it defaults to
127.0.0.1
and8080
(mitmproxy --help
). The instructions provided here are not the clear on what has to be accomplished. So you need to break it down.1. Configure `mitmproxy` to ensure you have TLS support. 1. Copy the resolution interceptor script and start `mitmproxy` with it: `mitmproxy -s /path/to/geforce-now-resolution-interceptor.py` . Keep that console open, you want to see the traffic intercepted there to know that everything is proxied. 2. Make sure you start a completely new instance of chrome, if you see Opening in existing browser session., you already have a chrome opened and it won't take into consideration --proxy-server. 3. Try to reach `http://mitm.it` again. It should show the TLS certificates instructions. Install the certificate and configure chrome to "Identify Websites": "Settings -> Privacy and security -> Security -> Manage certificates -> Authorities -> Import". 4. Once the certificate is allowed to "Identify Websites", check that `https://mitm.it` is loading without warning. 5. If you are here and it's working, you don't need `--proxy-server` or any other extensions to manage the proxy, you can continue with CLI flags as longs are you start a fresh chrome instance. 2. Configure Chrome to use the pac script 1. Copy the pac script and note the path 2. Update the `pac-script.js` script with your proxy address (default: 127.0.0.1:8080) 3. Start `mitmproxy` if you haven't 4. Start chrome with the `--proxy-pac-url` flag. **YOU CANNOT PASS A FILEPATH DIRECTLY**: `google-chrome-stable --proxy-pac-url='data:application/x-javascript-config;base64,'$(base64 -w0 /path/to/pac-script.js)` 5. When going to the GNF game webpage, you should start seeing traffic in the `mitmproxy` console.
That did the trick for me. Got some 1440p gaming.
Thanks! That worked perfectly!
I'm adding my 2 cents here are as the info I found here required a lot of digging and installing proxy extensions that are trying to do things Chrome does on it's on perfectly fine. My reply is also buried in that thread:
If you run mitmproxy, it defaults to127.0.0.1
and8080
(mitmproxy --help
). The instructions provided here are not the clear on what has to be accomplished. So you need to break it down.1. Configure `mitmproxy` to ensure you have TLS support. 1. Copy the resolution interceptor script and start `mitmproxy` with it: `mitmproxy -s /path/to/geforce-now-resolution-interceptor.py` . Keep that console open, you want to see the traffic intercepted there to know that everything is proxied. 2. Make sure you start a completely new instance of chrome, if you see Opening in existing browser session., you already have a chrome opened and it won't take into consideration --proxy-server. 3. Try to reach `http://mitm.it` again. It should show the TLS certificates instructions. Install the certificate and configure chrome to "Identify Websites": "Settings -> Privacy and security -> Security -> Manage certificates -> Authorities -> Import". 4. Once the certificate is allowed to "Identify Websites", check that `https://mitm.it` is loading without warning. 5. If you are here and it's working, you don't need `--proxy-server` or any other extensions to manage the proxy, you can continue with CLI flags as longs are you start a fresh chrome instance. 2. Configure Chrome to use the pac script 1. Copy the pac script and note the path 2. Update the `pac-script.js` script with your proxy address (default: 127.0.0.1:8080) 3. Start `mitmproxy` if you haven't 4. Start chrome with the `--proxy-pac-url` flag. **YOU CANNOT PASS A FILEPATH DIRECTLY**: `google-chrome-stable --proxy-pac-url='data:application/x-javascript-config;base64,'$(base64 -w0 /path/to/pac-script.js)` 5. When going to the GNF game webpage, you should start seeing traffic in the `mitmproxy` console.
That did the trick for me. Got some 1440p gaming.
Thanks! That worked perfectly!
What resolution are you now getting? Can you play 4K?
Can anyone confirm he gets anything MORE than 1440?
What resolution are you now getting? Can you play 4K?
Can anyone confirm he gets anything MORE than 1440?
2560x1440 is the maximum if not using the windows app aparently. I've tried 3440x1440 and it does not work (and apparently falls back to a lower 1080 ultra wide resolution).
What resolution are you now getting? Can you play 4K?
Can anyone confirm he gets anything MORE than 1440?2560x1440 is the maximum if not using the windows app aparently. I've tried 3440x1440 and it does not work (and apparently falls back to a lower 1080 ultra wide resolution).
I've just tested everything on my Fedora.
As you've mentioned, 3440x1440 doesnt works and falls back to lower 1080. However, even with 2560x1440, when turning on the Geforce Statistics, I noticed I have, first, good input, but after a minute or two, i get an input lag and Nvidia Resolution gets updated to a very very low resolution of 1706x720.
Does this happens to you too or does the Resolution on Nvidia Statistics overlay stay on 2560x1440?
Also, Codec used in my case is reported as H.264, 8-bit.
For me the resolution stayed at 2560x1440 and there is no major input lag (except once in a while for a second or so). Maybe you are having network issues? What is the report ping? Does it go up during those times?
For me the resolution stayed at 2560x1440 and there is no major input lag (except once in a while for a second or so). Maybe you are having network issues? What is the report ping? Does it go up during those times?
Hi. No, I, sadly have this issue without any package loss or higher ping. Actually, with fibreoptics, my ping is at constant 5ms connected to the Frankfurt server. I even tried Warsaw, with the same result. I tried different games, same result. Also tried Brave, Chrome. No changes. :(
I'm having the same issue. I tried it with a Mint 22.1 Live ISO with persistence on a USB3.0 connected HDD. The games start fine with 1440p (H.264, 8-bits too), but then they drop to 1080p and even lower. Mitmproxy shows that the proxy is filtering nvidiagrid.net as expected. I've tried Google Chrome and Microsoft Edge stable, and I've had the same issue with both. I also tried lowering the frequency to 60 Hz instead of 120 Hz (my screen supports 165 Hz) and disabling V-Sync in different games (C2077, Outlaws, BG3, etc.), which seemed to last a few seconds more, but didn't help either at the end.
I'm wondering if it could be a performance bottleneck with mimproxy on my PC, which isn't the newest, and also the fact that it's not a full Linux install? Of course, GFN runs fine with the same PC at 1440p under W10 with a 1Gbps internet connection.
@lordgreg the reason why nvidia disabled in on linux is because support for video hardware decoding support is very patchy. You must absolutely have it enabled in chrome, or else you'll have terrible lag and resolution will drop.
Go to chrome://gpu/
in Chrome and look if the Video Acceleration Information
section is populated.
This script does not seem to work anymore.
Can anyone confirm if this works?
Yes, I use this almost every day to get 2560x1440 in destiny 2.
This script does not seem to work anymore. Can anyone confirm if this works?
Confirmed to work.
how do you use it in the chrome then in fullscreen mode? how do you prevent when escape is being pressed that you dont get thrown out of full screen?
btw, this looks okay:
Additionally,
I've tested two browsers, Chrome and Brave from Flatpak, both having GPU Acceleration enabled, the installed RPM version of google chrome. All 3 of them yielded exactly the same result, lowering the resolution to unbearable 720 as soon as I started moving.
Unsure what is causing this, maybe my graphics card, maybe some entry missing under gpuinfo.
I'll probably give up eventually and reboot to windows when I'll want to play, or just move to boosteroid.
Thank you all for the suggestions and support :)
Is there any way to force 10 bit color support? Btw, the script for me works fine, 2k and 120 fps.
btw, this looks okay:
No it does not. "Video Decode" here, means that the feature is enabled. As I wrote, you need to have codecs listed in Video Acceleration Information
hi @kubrickfr and thank you for your feedback. Can you please post a screenshot on how this looks on your side?
Thank you in advance! 👍
I have tested this with the Nvidia GeForce app, Microsoft Edge and Google Chrome.
I have followed the guides completely, but it still isn't working.
The problem is that the requests the script intercepts, doesn't have content, so it can't replace that.
I have tried just changing the script so it just replaces the headers, and I see it getting replaced with "WINDOWS", but this doesn't change anything.
Could it be a regional thing?
I am from Denmark.
I have tested this with the Nvidia GeForce app, Microsoft Edge and Google Chrome.
How do you run Microsoft Edge on Linux? This hack is to allow Linux users to run at resolutions above 1080p, if you're already on Windows, this will do nothing for you.
I have tested this with the Nvidia GeForce app, Microsoft Edge and Google Chrome.
How do you run Microsoft Edge on Linux? This hack is to allow Linux users to run at resolutions above 1080p, if you're already on Windows, this will do nothing for you.
https://www.microsoft.com/en-us/edge/download?form=MA13FJ
You can just download it here. There is a deb file.
It is also available as a Flatpack on Flathub.
Ok, I didn't know that. I'm using it with the EU Central servers, it works well for me.
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.
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.
hi there @a9udn9u - can you show the output of the USER-AGENT, can you show the full headers and body you are sending? I think there's more to those entries.