This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-08
Channels
- # bangalore-clj (4)
- # beginners (88)
- # boot (12)
- # cljs-dev (10)
- # cljsjs (1)
- # clojure (284)
- # clojure-denmark (2)
- # clojure-dev (35)
- # clojure-italy (8)
- # clojure-russia (36)
- # clojure-spec (38)
- # clojure-uk (51)
- # clojurescript (145)
- # cursive (6)
- # data-science (1)
- # datomic (8)
- # duct (43)
- # emacs (9)
- # figwheel (2)
- # fulcro (29)
- # graphql (1)
- # immutant (3)
- # instaparse (1)
- # jobs (1)
- # jobs-discuss (1)
- # lumo (16)
- # off-topic (50)
- # onyx (90)
- # re-frame (6)
- # reagent (20)
- # remote-jobs (3)
- # ring-swagger (18)
- # schema (8)
- # shadow-cljs (141)
- # slack-help (3)
- # spacemacs (36)
- # unrepl (7)
- # vim (1)
- # yada (2)
@weavejester: any idea how to override /robots.txt
overriding a dynamic one in our app? We can’t seem to get the incantation right to stomp over https://github.com/duct-framework/module.web/blob/master/src/duct/module/web.clj#L107 in the config
@rickmoynihan You should just be able to put your own robots.txt
in your public resources directory.
@weavejester: we need to generate it dynamically from the database
and wrap-resource
’s precedence is higher than the handlers
@rickmoynihan Then you should just be able to set up a route with that. Your routes should override the static resources, and your static resources should override Duct’s defaults.
they don’t though because of this: https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/middleware/resource.clj#L36
@rickmoynihan Hm, I guess I’m getting confused between Compojure and Ring’s implementations.
In which case, you should just be able to override the :defaults
config…
Let me check…
yeah, I was pretty surprised that ring resources override routes; I expected routes to take precedence and resources to be a fallback
@rickmoynihan I believe it’s because Ring doesn’t view nil
handlers as not matching.
Though it could check 404…
hmm hadn’t realised that, interesting
so the nil
404 convention is a layer above ring?
Yeah, it’s a Compojure thing
Okay, so I’ve just checked, and this works:
:duct.middleware.web/defaults
{:static {:resources ^:replace ["foo/public"]}}
Add the :replace
metadata allows you to override the static resource paths.
hmm… ok, actually asking on behalf of a colleague — who has gone home now… and we had him try exactly that ^:replace
thing and he said it didn’t work
but both remote today, so hard to say for sure
Are you using the latest duct/module.web
version?
we’re currently on an older release
we have a ticket to upgrade 🙂
I think there was a bug in an earlier version that overrode bits it shouldn’t.
ok that’s what we’re seeing.
will check the version…
What version are you using, btw?
[integrant "0.6.1"] ;; can remove when we update duct
[duct/core "0.5.0"]
[duct/logger.timbre "0.2.0"]
[duct/compiler.cljs "0.1.2"]
[duct/server.figwheel "0.1.3"]
[duct/module.web "0.5.4" :exclusions [org.slf4j/slf4j-api org.slf4j/slf4j-nop]]
[duct/module.ataraxy "0.1.7"]
;; Logging dependencies
[duct/module.logging "0.2.0" :exclusions [org.slf4j/slf4j-api]]
According to the changelog, that version postdates some of the fixes I made in the module config merging.
However, other dependencies updates might have fixed bugs not listed in the changelog
And I can override robots.txt
on a sample project I just created
@rickmoynihan If the version update doesn’t fix it, ping me 🙂
haha will do 🙂
thanks for the help 🙂
I’ll also add a note to add an option to wrap-resource
to allow overriding by routes.
To maintain backward compatibility it’ll need to be an option
yeah that would fantastic
But in Duct it can be activated by default
perfect