Skip to content

Instantly share code, notes, and snippets.

View davidc0le's full-sized avatar

David Cole davidc0le

  • Stealth Startup
  • United Kingdom
View GitHub Profile
@JohannesRudolph
JohannesRudolph / cors.lua
Last active March 4, 2021 13:41
HAproxy Lua Script for answering CORS preflight requests (for OpenStack Swift)
core.register_service("cors-response", "http", function(applet)
applet:set_status(200)
applet:add_header("Content-Length", "0")
applet:add_header("Access-Control-Allow-Origin", applet.headers["origin"][0])
applet:add_header("Access-Control-Allow-Credentials", "true")
applet:add_header("Access-Control-Allow-Headers", "Origin, DNT, If-Match, If-Modified-Since, If-None-Match, If-Range, If-Unmodified-Since, X-Requested-With, Content-Type, X-Auth-Token, X-Service-Token, X-Newest, X-Trans-Id-Extra, X-Trans-Id, X-Account-Meta-Temp-URL-Key, X-Account-Meta-Temp-URL-Key-2, X-Timestamp, X-Openstack-Request-Id, X-Account-Bytes-Used, X-Account-Container-Count, X-Account-Object-Count, X-Account-Meta-Quota-Bytes, X-Account-Access-Control, X-Container-Meta-Temp-URL-Key, X-Container-Meta-Temp-URL-Key-2, X-Storage-Policy, X-Container-Object-Count, X-Container-Bytes-Used, X-Container-Meta-Quota-Count, X-Container-Meta-Quota-Bytes, X-Container-Read, X-Container-Write, X-Container-Sync-Key, X-Container-Sync-To
import requests
from requests.auth import HTTPBasicAuth
import re
from StringIO import StringIO
JIRA_URL = 'https://your-jira-url.tld/'
JIRA_ACCOUNT = ('jira-username', 'jira-password')
# the JIRA project ID (short)
JIRA_PROJECT = 'PRO'
GITLAB_URL = 'http://your-gitlab-url.tld/'