This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-02-05
Channels
- # announcements (1)
- # aws (6)
- # babashka (8)
- # beginners (22)
- # cider (12)
- # clj-kondo (1)
- # cljdoc (15)
- # clojure (109)
- # clojure-dev (6)
- # clojure-europe (40)
- # clojure-losangeles (5)
- # clojure-uk (1)
- # clojurescript (28)
- # data-oriented-programming (3)
- # datahike (9)
- # datalevin (9)
- # holy-lambda (2)
- # juxt (5)
- # lsp (4)
- # malli (2)
- # meander (1)
- # missionary (5)
- # nextjournal (3)
- # off-topic (17)
- # reagent (1)
- # reitit (8)
- # releases (1)
- # sci (16)
- # shadow-cljs (7)
- # sql (9)
- # tools-deps (9)
- # transit (1)
I have a webpage hosted in an S3 Bucket and using Static Website Hosting
I recently switched to using BrowserRouter style URLs eg
instead of
but now I have the problem that S3 wants to service the logged-in URL from the (non-existant) public/logged-in
file
whereas I want it to be directed to the cljs app at
and let react router pick up the specifics
Can I do this with S3 static website hosting?
oh actually https://stackoverflow.com/questions/16267339/s3-static-website-hosting-route-all-paths-to-index-html helped
I am trying to use io.pedestal.http.ring-middlewares.cookies
with io.pedestal.ions
using http-direct datomic-ions
but I see the error
"Msg": "http-endpoint respond failed: ",
"Ex": {
"Via": [
{
"Type": "java.lang.ClassCastException",
"Message": "class clojure.lang.LazySeq cannot be cast to class java.lang.String (clojure.lang.LazySeq is in unnamed module of loader 'app'; java.lang.String is in module java.base of loader 'bootstrap')",
"At": [
"cognitect.http_endpoint.jetty$respond_bbuf_STAR_",
"invokeStatic",
"jetty.clj",
342
]
}
],
I strongly suspect that this is because ring.middleware.cookies/write-cookies
is outputting a Set-Cookies Header like
"Set-Cookie" ("__HostID=eyJr***;Secure;HttpOnly;Expires=Mon Mar 07 22:58:14 UTC 2022;Path=/\")
does this mean that I am using the cookies interceptor wrongly?
Is there some io.pedestal.ions shim that I should be applying?
Do I have to write my own shim?so I can make this particular problem go away by writing
(def cookiehack-interceptor
(interceptor/interceptor
{:name ::cookiehack-interceptor
:leave
(fn [ctx]
(if-let [cookies (get-in ctx [:response :headers "Set-Cookie"])]
(cond (string? cookies) ctx
(seq? cookies) (assoc-in ctx [:response :headers "Set-Cookie"] (first cookies))
:else ctx)
ctx))
}))
is there a better way to solve this..?(it looks like (string/join \, cookies)
is discouraged...)