Coder Social home page Coder Social logo

Comments (2)

ejackson avatar ejackson commented on August 15, 2024

I have the same problem. When deploying into tomcat6 my app is put into a context path, and fetch points at the root, rather than the context path. I'm happy to patch this if somebody can point me in the direction of figuring out what the context path is in a running app ?

from fetch.

ejackson avatar ejackson commented on August 15, 2024

OK, I've got a workaround.

  • At first I pulled the context from the Ring request and passed that up to the .cljs and stitched it into the remote-uri var. Amusingly, something in the javascritp notices this and ADDS BACK IN the context path, so now I have it twice. So the original, incorrect, request goes to

http://myserver/_fetch

when I want to to got to

http://myserver/mycontext/_fetch

and by changing remote-uri to "mycontext/_fetch" I now have

http://myserver/mycontext/mycontext/_fetch.

How fun.

I don't know enough to figure out who is responsible for doing this. Maybe xhr or tomcat, or some interaction ?

  • So until a better solution can be found I've worked around the problem by adding a second _fetch handler to the noir side under the URI "/remotes/fetch" and on the cljs side stitched in a "remotes" to the remote-uri. Its not great, but its a workaround. So now by having this more complex URI the context gets magically reinserted and points to my handler. Baroque.

Code changes here:
https://github.com/ejackson/fetch/blob/master/src/noir/fetch/remotes.clj#L38
and here:
https://github.com/ejackson/fetch/blob/master/src/fetch/remotes.cljs

If anybody think of something better, or what I need to do to make this patchable, I'd love to fix this properly.

from fetch.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.