go-reverseproxy

command module
v0.0.0-...-af762dd Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2021 License: MIT Imports: 10 Imported by: 0

README

Welcome to GWebProxy

  • This is a reverse proxy built to enable authorization via a url key. All key maintenence is done via the admin api. It utilizes a basic authorizaton protocol.

To initialize make an http post request as described

https://{url}/api/key

Headers:
Referer: *url to proxy* (Ex. https://google.com)
Authorization: Basic *authkey*
  • The response will contain the key to your website
  • You can configure the code to return the full URL
  • You can configure the authentication for the API in the auth.go file

Other REST verbs perform the similar behaviors. The keys are associated to a URL through the Referer header. This will be used as the proxy value. It should contain the Scheme, Domain, and Path if necessary. It should not reference a page (like index.html)

Including GWebProxy auth in your app (Node Example)

#!javascript

var express = require('express');
var app = express();

var authMiddleware = function(req, res, next) {
    if (req._parsedUrl.pathname === "/") {
        var options = {
            host: 'gwebproxy.ultilabs.xyz',
            path: '/api/key/' + req.query.key
        };

        var callback = function(response) {
            if(response.statusCode === 200) {
                next();
            } else {
                res.send(401)
            }
        };

        https.request(options, callback).end();
    } else {
        next();
    }
};

// Auth for EVERY request
app.use(authMiddleware);
app.use(express.static(__dirname + "/client"));

// On a route
app.post('/keywords', authMiddleware, function(req, res) {
    res.send(JSON.stringify({
        cool: "beans"
    }));
});

Dependencies

Gorilla

UUID

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL