Sha256: f846e0c5690a4543fd8cb127eb3efdd560d7e00a00ec7b79655b34bd6c8dac5a
Contents?: true
Size: 1.01 KB
Versions: 1
Compression:
Stored size: 1.01 KB
Contents
require 'wovnrb' module Wovn module ReverseProxy # Fixed Wovnrb for reverse proxy. class Wovnrb < Wovnrb::Interceptor def initialize(app, opts = {}) super @setting_keys = @store.instance_eval { @settings.keys } end def call(env) opts = get_wovn_settings(env) @store.reset @store.settings(opts) super end private def get_wovn_settings(env) settings = @setting_keys.each_with_object({}) do |key, params| env_key = "HTTP_X_WOVN_#{key.upcase}" value = env[env_key] next unless value params[key] = get_appropriate_value(key, value) end settings.merge('use_proxy' => true) end def get_appropriate_value(key, value) if key == 'query' || key == 'supported_langs' value = value.split(/,/) elsif key == 'test_mode' || key == 'use_proxy' value = false if value.casecmp 'false' end value end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wovn-reverse_proxy-0.0.1 | lib/wovn/reverse_proxy/wovnrb.rb |