walkor / walkor/php-http-proxy

https+wss proxy

Offen
#13 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
PHP
Sterne
206
Forks
91
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

Hi @walkor. In my project, i'm using this awesome example of http proxy server. And its work fine. Btw its work for http+websocket proxy.
But when i try to use it with https and wss its fail.
I see, that this is because in method "onMessage" i have encrypted data. Can you pls help me to solve this task?

Of cource, when i do this

```php
$remote_connection->pipe($connection);
$connection->pipe($remote_connection);
$remote_connection->connect();
```
data passing encrypted to destination and its not what he expects.

I try to replace tcp://0.0.0.0:xxx to http://0.0.0.0:xxx, but it still not working. Pls, help me.

Here is my minimal code, for reproduce

```php
array(
'local_cert' => app_paths['ssl_public_key'], // Alternatively, it can be a crt file
'local_pk' => app_paths['ssl_private_key'],
'verify_peer' => false,
'allow_self_signed' => true,
)
);

$worker = new Worker('tcp://0.0.0.0:' . $args['port'], $context);
$worker->transport = 'ssl';

$worker->onMessage = function ($connection, $buffer) use ($args) {

list($method, $addr, $http_version) = explode(' ', $buffer);
$remote_connection = new AsyncTcpConnection("tcp://{$args['proxy-ip']}:{$args['port']}");
if ($method !== 'CONNECT') {
$remote_connection->send($buffer);
} else {
$connection->send("HTTP/1.1 200 Connection Established\r\n\r\n");
}
$remote_connection->pipe($connection);
$connection->pipe($remote_connection);
$remote_connection->connect();

};
```

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Rechercherichtung

Beginne mit der minimalen Reproduktion im Issue und untersuche den onMessage-Handler, einschließlich des Worker- und AsyncTcpConnection-Setups sowie der CONNECT-Behandlung. Reproduziere den HTTPS/WSS-Fehler und überprüfe anschließend, dass der Proxy einen funktionierenden verschlüsselten Tunnel aufbaut, ohne das bestehende HTTP/WebSocket-Verhalten zu beeinträchtigen.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
25/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.