This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (3)
- # announcements (1)
- # beginners (9)
- # boot (85)
- # bristol-clojurians (4)
- # cider (12)
- # cljs-dev (3)
- # clojure (91)
- # clojure-berlin (7)
- # clojure-dev (16)
- # clojure-italy (21)
- # clojure-russia (67)
- # clojure-spain (3)
- # clojure-uk (6)
- # clojurescript (139)
- # core-async (41)
- # cursive (7)
- # datomic (61)
- # editors (56)
- # events (16)
- # hoplon (11)
- # jobs (4)
- # ldnclj (14)
- # liberator (7)
- # off-topic (13)
- # om (5)
- # re-frame (22)
- # ring-swagger (27)
is there a built in option in ring to serve a default index.html file? i found this middleware to do exactly what i need: https://github.com/relaynetwork/ring-middleware-index-file but i suspect there should be no extra package necessary for this.
Just as the linked page explains, I would like to do:
(wrap-index-file “/some/route”) • Requests to /some/route will redirect to /some/route/. • Requests to /some/route/ will return the index.html file.
Although I've just found out that my middleware library just started to support this by default recently: https://github.com/pandeiro/boot-http/commit/b310feb852d141248401a27938e87c0f77e7ea8f
this is how I feel tonight https://twitter.com/kidpollo/status/631347151898046464
I have an empty route table with compojure and it’s still able to server static files from public. Any ideas why?
wrap-defaults is what was adding the static management. sandbags I did, but I removed it and I was surprised it kept on working.
I'm hopeful this is a dumb question with an easy answer that I'm just missing: in Ring is there a way to know if the last request was the result of a redirect?
timgilbert: sure, but I need to know if the previous request was a redirect, not if the current one is. e.g. "was the user redirected to this URL" not "Is this request a redirect"
the best I've been able to come up with is adding a middleware that looks for redirects and
assoc's a flag to the session when the request is a redirect and
dissoc's it when it's not.
and that doesn't work since only the request passes through midddleware and the response is the only thing that indicates that a given request resulted in a redirect
I think in general you can't see that a request came from a redirect inside http. I'd vote for looking at the RFC though
I'm working at a rate-limitter and I don't want to frequency-based rate-limiting of redirected requests
tcrayford: no, you are correct. The "Location" header is handled on the client and is not mentioned in the respondent request
can you just redirect with a query param that you then strip inside a middleware then?
that's been my initial tact, but becoming aware of whether the previous request was a redirect was where I got stuck… and the redirect response as provided by ring.util.response doesn't have access to the request
I can just stop using
ring.util.response/redirect since it doesn't do all that much and require the request is passed in so I can
assoc a key to the session when issuing a redirect
for some definition of reasonable 😄 That just requires I touch a lot more code than I was hoping to.
thanks for helping me think through it though and glad to know I wasn't too far off in my efforts.
I don't suppose there's something analogous to ring's middleware that operates on responses, rather than requests?
the middleware is all chained up - the request goes in, the response comes out so if you want to get hold of the response, you can do this
(defn my-middleware [handler] (fn [request] (let [response (handler request)] (assoc response :foo :bar))))
@voxdolo, kind of hacky and maybe not 100% reliable, but maybe you could check the
Refrerrer header and use some heuristics to determine redirects if you are looking for them from a specific source?
@timgilbert: I was able to determine if the response was a redirect by calling the handler on the request as oliy suggested
Is there an Apache project that's a good fit for record storage? I'm (ab)using Lucene with an
_id property to emulate an embedded MongoDB and it smells pretty bad.
I'm trying to build a tool for tracking my own todo list and notes which must be able to 1) function offline 2) be able to synchronize across machines 3) do full text searching. What I'm currently thinking about is essentially using a Git like FS backed hash named object store (which will synchronize nicely with existing tools) and a parallel solr index for content.
But I'm not convinced that's the best minimal solution because it means reinventing something that's either Git or Datomic done badly or both.
I have two maps, and I want to see if they are "equal", meaning they are exactly the same in contents (keys / values).
exampleperm but then comparing
Is here something like
partition-by that partitions when a fn returns a specific value, rather than a different value?
I guess I could just write the reduction myself, but that seems deceptively close to a partition-by trick...
anyone know of common causes for errors like "CompilerException java.lang.IllegalArgumentException: Can't define method not in interfaces" when it's very clearly defined in the interface and used to work?
Are there helpers for writing macros? I am trying to write a macro which walks the syntax tree passed to it and basically pattern-matches-replaces some constructs. Walking the tree manually is a bit of work.
arrdem: you can probably run it embedded too, but that's maybe too large/heavyweight of a dependency for your use case
Hello. I have been hinted to join this chat room to ask Datomic question. Please advice?
you're showing (getpermission exampleperm) but comparing exampleperm ? should that be (= targetperm (getpermission exampleperm)) ?
@arrdem: I've embedded an ES server before. If you need some code... it also runs fine with like 200MB RAM. Nothing too crazy