Can I create a HTTP proxy with glitch?


My understanding so far is that an proxy server is ‘just a web server’, but I haven’t been able to receive proxying requests. My purpose is to set up a proxy server that I can control so that I can debug a proxy authentication issue for a different project. Please advise. Thanks.

I have this so far:

var http = require('http');
http.createServer(function(request, response) {
  var host = request.headers['host'];
  console.log(`port: ${process.env.PORT}, host: ${host}`);
  request.addListener('data', function(chunk) {
  request.addListener('end', function() {
    response.statusMessage='Auth please.';

I can do curl http://proxy-project and I see my logging messages and am getting back a 407 response.

But curl with proxy:
curl -v -x http://proxy-project:80 http://target-url does not produce logging messages and returns this response

* Rebuilt URL to: http://target-url/
*   Trying
* Connected to proxy-project ( port 80 (#0)
> GET http://target-url/ HTTP/1.1
> Host: target-url
> User-Agent: curl/7.54.0
> Accept: */*
> Proxy-Connection: Keep-Alive
< HTTP/1.1 404 Not Found
< Date: Fri, 22 Dec 2017 06:30:15 GMT
< Transfer-Encoding: chunked
< Connection: keep-alive
< x-powered-by: Express
<!DOCTYPE html>
<html lang="en">
    <meta charset="utf-8">
    <title>👻 Project Not Found</title>
    <meta name="viewport" content="initial-scale=1, width=device-width">
    <link rel="stylesheet" type="text/css" href="">
    <script src=""></script>
    <script src=""></script>
  <body class="error-page ghost-border">
    <div class="container">

        Project Not Found

        Maybe a typo? Or maybe it's been renamed?

      <div class="actions">
        <a href="">
          <div class="gomix-logo bird">

    <canvas id="stars"></canvas>

* Connection #0 to host proxy-project left intact


If that’s all of the code in your project, then there’s nothing there to do the proxying. I’m not sure why you’re getting a Project Not Found response there. Take a look at http-proxy on npm:


I am not interested in making a complete proxy, just something where I can debug proxy authentication.

I think I am getting the 404 because curl’s proxying code is not sending a host name header to glitch, so glitch doesn’t know which project to forward the request to.


That’s possible. Our proxy needs that info to find your project.


Hi @iamphi,

Instead of curl -v -x http://proxy-project:80 http://target-url, can you try something like this (ie. add the Host header so that the Glitch platform knows which project to hit):

$ curl -v -H 'Host: proxy-project' -x http://proxy-project:80 http://target-url

I’ve never used proxies with curl before so I’m not sure that will work but it’s worth a quick go perhaps.