Sign inSign up

mik9/headerless

By mik9

•Updated over 8 years ago

App that translates query parameters to http headers. For environment where headers can't be used.

Image
0

171

mik9/headerless repository overview

⁠Headerless

Simple proxy for environments where you can do HTTP requests but it's hard or imposible to use HTTP headers (like Mikrotik Router OS).

Can be used directly⁠, with docker⁠ or with Amazon Lambda⁠.

⁠Usage

Pass any values as query and they will be translated into headers. Except next:

  • headerless_token - authorization, required.
  • headerless_url - url to request, required.
  • headerless_method - http method used to query URL, optional. By defaut GET.
  • headerless_body - body to be sent to URL, optional.

For example:

http://127.0.0.1:8000/?headerless_token=secret&headerless_url=http://httpbin.org/anything&test_header=test&User-Agent=me&headerless_method=POST&headerless_body=123

Will be translated to:

POST /anything HTTP/1.1

Accept-Encoding: gzip
Connection: close
Content-Length: 3
Host: httpbin.org
Test-Header: test
User-Agent: me

123

⁠TLS

Can be run with TLS. To do so add next environment variables:

  • TLS_CERT - path to your .crt file
  • TLS_KEY - path to your .key file

⁠Directly

Build with:

go get && go build

Run with:

HEADERLESS_TOKEN=secret ./headerless

⁠Docker

Using prepared image:

docker run -d -p 8000:8000 -e HEADERLESS_TOKEN=secret mik9/headerless

Or build yourself:

docker build -t headerless .
docker run -d -p 8000:8000 -e HEADERLESS_TOKEN=secret headerless

⁠Amazon Lambda

Build for Lambda:

GOOS=linux GOARCH=amd64 go build --tags LAMBDA -o lambda

Deploy to Lambda with any way you like, for example:

zip lambda.zip ./lambda
aws lambda update-function-code \
    --function-name YOUR_LAMBDA \
    --zip-file fileb://lambda.zip

Create API Gateway for this lambda and enable Use Lambda Proxy integration in integration step.

Tag summary

Content type

Image

Digest

Size

122 MB

Last updated

over 8 years ago

docker pull mik9/headerless