-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Should fnhouse look at the :path-info key? #32
Comments
Thanks for the report. My inclination is that this is better handled in middleware around the fnhouse root handler than within fnhouse itself. That said, I'm not familiar with jboss; does that seem reasonable, or do you have an argument for why fnhouse should know about this? |
I think the argument would only make sense if It does feel pretty middlewarey to me too though, or even like maybe things like jboss should use I wonder if @tobias has any context (ha!) on this. |
Sounds reasonable to me -- let us know if you figure out the answer :) Thanks! |
Hi guys. @tobias referred me. This is not a jboss issue; it's a servlet issue. Neither |
thanks @jcrossley3 Another detail, @w01fe, is that (after glancing at the source code) I believe compojure uses Fnhouse I think just applies prefixes in a different fashion, using In any case I'll leave the final judgement up to you. I'm currently using this middleware, is this what you had in mind or would it be different somehow? (defn- wrap-fnhouse-path-info-hack
"Copies the :path-info key of the request to :uri when present, so
that our routes work when deployed to JBOSS.
See https://github.com/Prismatic/fnhouse/issues/32 for details."
[handler]
(fn [request]
(-> request
(cond-> (contains? request :path-info)
(assoc :uri (:path-info request)
::orig-uri (:uri request)))
(handler)))) |
Thanks for the context, @jcrossley3 -- that's very helpful. @gfredericks yep, that looks like what I had in mind. I guess I don't see any harm in concatenating the path-info here, since it seems like probably the least surprising option: https://github.com/Prismatic/fnhouse/blob/master/src/fnhouse/routes.clj#L129 Or as an alternative, we could add your middleware to the middleware.clj file so it's ready-at-hand. |
We just converted a bunch of routes from compojure to fnhouse, and noticed that they didn't work when deployed to a jboss context (with a route prefix).
As best as I can tell, the request coming in from the jboss machinery has at least three interesting keys:
It seems that compojure was able to use the
:path-info
key when available, but fnhouse does not.The ring spec does not mention
:path-info
or:context
, so I can't say how standard these are.Obviously there are some easy workarounds here, but I was wondering if fnhouse ought to support this somehow.
The text was updated successfully, but these errors were encountered: