ring

kah0ona 2017-06-06T14:41:59.636298Z

Hello guys, I have a problem with Content-Security-Headers being returned and preventing my .js files to be loaded. Where/how can I configure those? Is this something a recent version of Ring is doing, or is it in ring-headers?

2017-06-06T15:36:18.074379Z

@kah0ona Ring doesn’t add any itself, but Ring-Defaults does. Are you using that middleware?

kah0ona 2017-06-06T15:37:39.108982Z

aah thanks

kah0ona 2017-06-06T15:38:50.139330Z

Do you know which specific middleware adds Content-Security-Headers?

kah0ona 2017-06-06T15:42:51.240423Z

hm it seems to be ring.middleware.x-headers, but that only adds X-Content-Secuirty-Policy headers, rather than the one without X- prefix..

2017-06-06T15:55:20.565324Z

@kah0ona Oh, you mean like Content-Security-Policy?

2017-06-06T15:55:34.571173Z

So you’re not talking about security headers in general?

kah0ona 2017-06-06T15:56:03.583951Z

aah

kah0ona 2017-06-06T15:56:06.585319Z

i just realized the problem

kah0ona 2017-06-06T15:56:08.586014Z

it’s in pedestal

kah0ona 2017-06-06T15:56:14.588697Z

well; since our pedestal upgrade

2017-06-06T15:56:19.591138Z

X-Content-Security-Policy is the old name for the header. That should probably be updated.

kah0ona 2017-06-06T15:56:20.591217Z

they also add middleware

kah0ona 2017-06-06T15:56:28.595085Z

https://github.com/pedestal/pedestal/issues/466

kah0ona 2017-06-06T15:56:44.601815Z

sorry for the inconvenience 🙂 I can fix this problem now

2017-06-06T15:57:01.608939Z

No problem 🙂 - it can be hard to find which middleware adds which headers.

2017-06-06T15:57:08.611951Z

Or interceptor, in Pedestal’s case.

kah0ona 2017-06-06T15:57:12.613400Z

yeah indeed

kah0ona 2017-06-06T15:58:30.647471Z

we use both pedestal and ring in this codebase, i mixed it up. end of the day here… not too sharp 🙂

JAtkins 2017-06-06T16:31:33.462473Z

How do I use middleware? I want to use ring-partial-content, but I'm not sure how to use it. (I'm working on my first ring/clojure/web project, so I don't know much about servers)

2017-06-06T17:31:34.842189Z

@jatkin Middleware takes in a handler as an argument, and returns a handler.

2017-06-06T17:31:39.844413Z

There’s more about it here: https://github.com/ring-clojure/ring/wiki/Concepts#middleware

petr.mensik 2017-06-06T20:46:14.904260Z

Hello guys, I am currently facing strange problem that I can build my project with lein repl or lein ring server, however when I try lein ring uberwar I get

Can't import ring.util.response/find-header, try updating to Ring 1.6.0+
Above problem is caused by https://github.com/metosin/ring-http-response/ library. It almost seems like ring-http-response is being added as dev dependency but I really don't know why 😕

seancorfield 2017-06-06T20:50:40.001554Z

Sounds like something is pulling in an older version of Ring as a (transitive) dependency. Try lein deps :tree to see if you can identify where the older Ring is coming from?

petr.mensik 2017-06-06T20:54:52.089426Z

Yeah, I tried that before and nothing seems to collide with ring or ring/ring-core

petr.mensik 2017-06-06T20:56:43.128073Z

Actually it does, weird is that lein deps :tree | less is actually not giving suggestions by lein

petr.mensik 2017-06-06T20:56:51.130839Z

that's why I didn't see it

petr.mensik 2017-06-06T21:02:30.250523Z

Ok, even so, I don't really see any offending deps there https://pastebin.com/tPe6qXBH

seancorfield 2017-06-06T21:20:27.592974Z

[lib-noir "0.9.3"] -> [ring-middleware-format "0.4.0"] -> [ring "1.3.0"] -> [ring/ring-devel "1.3.0"] -> [hiccup "1.0.5"]

seancorfield 2017-06-06T21:20:39.596590Z

That’s bringing in an old version of Ring.

seancorfield 2017-06-06T21:22:59.638762Z

You might also want to check which version of lein-ring you’re using.

petr.mensik 2017-06-06T22:12:03.435498Z

I'll look at it, thank you