GTProxy includes a built-in HTTPS web server that intercepts and modifies Growtopia’s server data requests. This allows the proxy to redirect the game client to connect through the local proxy server.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ZTzTopia/GTProxy/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The web server intercepts the Growtopia client’s initial HTTPS request to retrieve server connection information. It forwards the request to the official server, modifies the response to point to the local proxy, and returns it to the client.Server Configuration
The HTTPS port where the web server listens.This is hardcoded to port 443 (standard HTTPS port) in the implementation (src/core/web_server.cpp:28). The server binds to
0.0.0.0 to accept connections from any network interface.Path to the SSL certificate file.Required for HTTPS connections. The certificate must be trusted by the Growtopia client for secure connections.
Path to the SSL private key file.Required for HTTPS connections. This key must correspond to the SSL certificate.
How It Works
The web server operates as follows:- Client Request: The Growtopia client makes an HTTPS POST request to
/growtopia/server_data.php - Request Forwarding: The proxy forwards this request to the official server using the configured DNS resolver
- Response Modification: The proxy modifies the response to replace:
serverfield →127.0.0.1(localhost)portfield → The proxy server port from config (default: 16999)type2field →1(forces specific connection type)
- Client Connection: The client receives the modified response and connects to the local proxy
- Proxy Connection: The proxy then connects to the real server on behalf of the client
Request Interception
The web server intercepts the/growtopia/server_data.php endpoint (src/core/web_server.cpp:75):
- HTTP headers
- Query parameters
- Request body
- Original and modified server data
DNS Resolution
The web server uses the DNS resolver configured in the client configuration (src/core/web_server.cpp:22):SSL/TLS Setup
For the HTTPS server to work, you need valid SSL certificates:Certificate Files
Place the following files in theresources/ directory:
cert.pem- SSL certificatekey.pem- SSL private key
Installing the Certificate
The Growtopia client must trust your SSL certificate. This typically involves:- Installing the certificate in your system’s trusted certificate store
- Configuring the Growtopia client to accept your certificate
- Using a certificate signed by a trusted Certificate Authority (CA)
Response Format
The server data response is in a custom text format parsed byutils::TextParse:
Event Integration
The web server listens for client connection events (src/core/web_server.cpp:33-34):- ClientConnect: When a client connects to the proxy, the web server initiates a connection to the real Growtopia server
- ClientDisconnect: When a client disconnects, pending connection data is cleared
Error Handling
The web server handles various error conditions:500 Internal Server Error
Returned when:
- DNS resolution fails for the server address
- TextParse fails to parse the server response
- Port number parsing fails
502 Bad Gateway
Returned when:
- Cannot connect to the official Growtopia server
- Official server returns a non-200 HTTP status
- Server response body is empty
Logging
The web server logs all HTTP requests and responses (src/core/web_server.cpp:48-50):- Request headers, params, and body
- Original server_data.php response
- Modified server_data.php response (when debug logging is enabled)
- Connection events and errors