Skip to content

Instantly share code, notes, and snippets.

View sedkis's full-sized avatar
🌴
Working Remotely

Sedky Haider sedkis

🌴
Working Remotely
View GitHub Profile
@sedkis
sedkis / deploying-plugins.md
Created November 10, 2025 15:01
Custom PLugin overview
title description tags
Deploying Custom Plugins: Volume Mounts vs Bundles
Understand the trade-offs between volume-mounted files and plugin bundles when supplying custom middleware to Tyk Gateway.
Custom Plugins
Plugin Bundles
Deployment
Kubernetes

Why plugin location matters

Tyk Gateway only runs a custom plugin if the file (JavaScript, Python, gRPC stub, Go .so, etc.) is reachable at the path declared in custom_middleware or middleware.global within your API definition. You therefore need a repeatable way to make that file available inside every Gateway instance—either by shipping it with the container filesystem or by letting the Gateway download it at runtime. This page compares the two supported patterns so you can choose the right fit for your environments.

@sedkis
sedkis / plugin.go
Created September 17, 2025 15:52
Custom Rate Limit Pattern (via Custom Plugin)
package main
import (
"bytes"
"context"
"encoding/base64"
"io/ioutil"
"net/http"
"os"
@sedkis
sedkis / ingest upstream SSE .json
Created November 4, 2024 16:14
Tyk Streams Examples
{
"info": {
"title": "test",
"version": "1.0.0"
},
"openapi": "3.0.3",
"servers": [
{
"url": "http://localhost:8080/test/"
}
@sedkis
sedkis / readme.md
Last active June 18, 2024 20:30
Custom PS256 JWT Auth Tyk
// TerminateRequest checks for a specific query parameter and terminates the request if present.
func TerminateRequest(rw http.ResponseWriter, r *http.Request) {
// Check for the query parameter
if value := r.URL.Query().Get("terminate"); value == "true" {
// Prepare the data to send in response
responseData := map[string]string{
"message": "Request terminated by custom Tyk plugin.",
}
jsonData, err := json.Marshal(responseData)
if err != nil {
var auth0OAuthClientCredMiddleware = new TykJS.TykMiddleware.NewMiddleware({});
// "Cache"
zendeskAccessToken = {
token: "",
expiry: 0,
}
salesforceAccessToken = {
token: "",
@sedkis
sedkis / index.html
Created September 8, 2022 01:03 — forked from lillylangtree/index.html
sample index.html file
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Spoon-Knife</title>
<LINK href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
@sedkis
sedkis / README.md
Created August 16, 2022 11:19
Go Plugin
  1. compile plugin

  2. load into gateway

  3. use the below YAML:

apiVersion: tyk.tyk.io/v1alpha1
from locust import HttpLocust, TaskSet, task
def index(l):
l.client.get("/")
def stats(l):
l.client.get("/stats/requests")
class UserTasks(TaskSet):
# one can specify tasks like this
@sedkis
sedkis / gist:df682fda62c9bd4a1e91326bfe2ed7cf
Last active August 24, 2023 15:33
Install docker on AL2
sudo yum -y install docker git; \
 sudo service docker start; \
 sudo usermod -a -G docker ec2-user; \
 sudo chkconfig docker on; \
 sudo curl -L --fail https://raw.githubusercontent.com/linuxserver/docker-docker-compose/master/run.sh -o /usr/local/bin/docker-compose; \
 sudo chmod +x /usr/local/bin/docker-compose; \
 sudo reboot;

Here is a quick and dirty cmd that I threw together.