This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-11-20
Channels
- # babashka (56)
- # beginners (151)
- # calva (3)
- # cider (31)
- # clj-kondo (17)
- # cljs-dev (5)
- # clojure (26)
- # clojure-australia (21)
- # clojure-dev (7)
- # clojure-europe (23)
- # clojure-nl (5)
- # clojure-spec (54)
- # clojure-uk (11)
- # clojuredesign-podcast (8)
- # clojurescript (77)
- # community-development (10)
- # core-typed (1)
- # cursive (3)
- # datomic (7)
- # docker (67)
- # emacs (10)
- # expound (6)
- # figwheel-main (3)
- # graalvm (67)
- # helix (10)
- # java (13)
- # jobs (6)
- # kaocha (4)
- # leiningen (15)
- # malli (2)
- # meander (31)
- # off-topic (40)
- # pedestal (9)
- # rdf (7)
- # reagent (5)
- # reitit (9)
- # remote-jobs (5)
- # shadow-cljs (94)
- # sql (7)
- # testing (12)
- # tools-deps (75)
- # vim (13)
with a proxy like Nginx or Kong?
@lkottmann no proxy at the moment. I don't expect I'll need one, though if that's the preferred way to get rate limiting I guess I will?
there are ring middlewares if you want a clojure-only solution
I guess an alternative to using ring-middleware in a Pedestal app is to use one these Jetty filters: • https://www.eclipse.org/jetty/documentation/current/dos-filter.html • https://www.eclipse.org/jetty/documentation/current/qos-filter.html I would want to do it from Clojure, though, not through XML. Anyone have any experience setting up Jetty filters in Pedestal?
Perhaps using the `:context-configurator` key in the Jetty configuration and code similar to this? https://www.programcreek.com/java-api-examples/?class=org.eclipse.jetty.servlet.ServletContextHandler&method=addFilter I have no idea how to use `:context-configurator` though. The Pedestal documentation simply says: > “A function called with the `org.eclipse.jetty.servlet.ServletContextHandler` instance. Use when advanced customization is required.”
Scratch that, I got confused. `:context-configurator` is a just function you define taking one arg (the current org.eclipse.jetty.servlet.ServletContextHandler) and obviously methods can then be called on it in that context.
Here how I use context-configurator
(defn context-configurator
[^ServletContextHandler context]
(let [gzip-handler (GzipHandler.)]
(.setExcludedAgentPatterns gzip-handler (make-array String 0))
(.setGzipHandler context gzip-handler))
context)
... ::http/container-options {:h2c? true
:context-configurator context-configurator}