如何在Godot 3中配置网络代理及代理授权?
Hey there! I’ve dealt with proxy setups in Godot 3 before, so let me walk you through the steps to get it working with authentication smoothly.
Configuring Proxy Authentication in Godot Engine 3
1. Using the Editor's Graphical Interface
Godot 3 has built-in proxy settings that are straightforward once you know where to look:
- Open Godot 3, then go to Editor > Editor Settings (or use the shortcut
Ctrl+,on Windows/Linux,Cmd+,on macOS). - In the left sidebar, navigate to Network > HTTP.
- Fill in the required fields:
Proxy Host: Your proxy server’s IP address or domain (e.g.,proxy.yourcompany.com).Proxy Port: The port your proxy uses (common values are8080or3128).Proxy User: Your proxy username if authentication is required.Proxy Password: Your proxy password corresponding to the username.
- Click Save Settings at the bottom right, then restart the editor to ensure changes take effect.
2. Manual Configuration via the Config File
If the GUI isn’t working for you, or you prefer editing files directly, modify the editor config file:
- Locate the Godot 3 configuration folder based on your OS:
- Windows:
%APPDATA%\Godot\editor_settings-3.tres - Linux:
~/.config/godot/editor_settings-3.tres - macOS:
~/Library/Application Support/Godot/editor_settings-3.tres
- Windows:
- Open the file with a text editor, find the
[network/http]section, and add/modify these lines:proxy_host = "your_proxy_host" proxy_port = your_proxy_port proxy_user = "your_proxy_username" proxy_password = "your_proxy_password" - Save the file and restart Godot—your proxy settings will be applied immediately.
3. Testing the Proxy Setup
To confirm everything’s working, run a quick test script:
- Create a new GDScript file, attach it to a node, and paste this code:
extends Node func _ready(): var http = HTTPRequest.new() add_child(http) http.request("https://example.com") yield(http, "request_completed") if http.get_response_code() == 200: print("Proxy connection successful!") else: print(f"Proxy connection failed. Response code: {http.get_response_code()}") - Run the scene. If you see "Proxy connection successful!", your setup is good to go. If not, double-check your proxy details (host, port, credentials) and ensure your proxy allows outgoing connections to the test URL.
Key Notes
- Proxy Type Limitation: Godot 3 natively supports HTTP/HTTPS proxies only. For SOCKS proxies, you’ll need a third-party tool like
proxychains(Linux) or a similar utility to forward traffic. - Security Reminder: Your proxy password is stored in plain text in the
editor_settings-3.tresfile. If security is a concern, consider using an unauthenticated proxy or a dedicated proxy tool that handles credentials securely. - Project-Specific Settings: If you need proxy config for a single project instead of the global editor, add the same
network/httpentries to your project’sproject.godotfile under the[editor]section.
内容的提问来源于stack exchange,提问作者Kuan
相关产品推荐
相关产品推荐

