innoq / statuses

statuses
Apache License 2.0
13 stars 14 forks source link

Redirect from /statuses to /statuses/updates not working #135

Closed mvitz closed 9 years ago

mvitz commented 9 years ago

After we switched to serving the static resources from the JARs classpath by using wrap-resource instead of wrap-file the redirect from /statuses to /statuses/updates is broken.

The root of this seems to be that /statuses is now tried serving from the resources (there is a resource/public/status folder) which leads to a NullPointerException in the used jetty adapter. It seems to be no good idea to have a folder below resources/public with the same name as a route defined in src/statuses/routing.clj. Therefore the simplest fix would be to not have a folder resources/public/statuses but because of some innoQ internal infrastructure it needs to be served below /statuses...

Anybody another idea? The worst case is to revert bb309eb87a5baa986d979c5c1e2b24f6a5f0d40d and serve the resources from the file system again.

stilkov commented 9 years ago

We could stick to relative links within statutes itself, except for Location headers and URIs in feeds (which need to be absolute). These would need to know the base external base URI, which we would have to pass in from the outside world in some X_… header (so @offlinehoster would have to configure it).

aheusingfeld commented 9 years ago

+1 for the base-uri configuration variable. IMHO an application should be self-aware of the URIs it may be addressed as. I didn't realize this before but https://github.com/innoq/statuses/blob/master/src/statuses/views/common.clj#L17 basically means you cannot deploy statuses with a different context-root than /statuses. :-| We should definitely fix this.

some X_… header

To prevent others from hitting the same wall I faced: HTTP headers with underscores are considered to be "legacy headers" and are therefore dropped by Apache and nginx

I'd really favor a base-uri configuration variable instead of an x-application-uri HTTP header that comes with each request. This way the app can make use of it at any time in any place.

mvitz commented 9 years ago

base-url is one of the things I have on my ToDo list. But the bug has nothing to do with absolute vs. relative URLs (see ring-clojure/ring#169).