the fast, reliable localhost tunneling solution


2011-12-27, 02:02

How to create the MySQL backend?

is it like


  1. Bjarni RĂșnar Einarsson said on 2012-01-02, 12:40
    No, MySQL does not use the HTTP protocol. You could use a line like this:


    ... but note that you would need to use a MySQL client which can speak the HTTP Proxy protocol when connecting, as the service does not have native support for routing the MySQL protocol. What this means is that your MySQL client needs to connect to the HTTP proxy on `` and make a CONNECT request to ``.

    If you are writing the client yourself, this is a simple as connecting to port 443 and sending the following string:

    CONNECT HTTP/1.0\r\n\r\n

    The server will reply with:

    HTTP/1.0 200 Connection Established\r\n\r\n

    After that you can continue with the MySQL protocol over the connection as usual. This technique works for any TCP protocol.

    If you are not writing the client code yourself, you may want to give the `lapcat` tool which is included in the Debian and RPM packages a try...

    First, create a file in `/etc/lapcat/` named ``, with the following lines:

    chain = default, httpc:%h:443

    Then invoke the mysql client like so:

    mysql -h --port=$(lapcat --tp

    What is happening here, is `lapcat` will listen on a random port and when the mysql client connects to that, it will forward the connection over the HTTP Proxy on the PageKite front-end, thus connecting the mysq client with your server. This is probably only useful for debugging, you'll need a more robust solution if you want to use this more regularly. Feel free to stop by on the IRC channel to have a chat sometime.
  2. Asker said on 2012-01-03, 09:25
    Thanks for your explanation. Thats mean a lot. =)

Leave a comment

( (Please leave these blank: )

We use Gravatar for commenter's photos. Get your own, it's free!