Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Rewrite of Absolute URL in Knox?

avatar
Super Collaborator

I am trying to define a rewrite pattern in Knox that would rewrite a URL like https://sandbox:8443/myLogo.png to https://sandbox:8443/gateway/default/myservice/myLogo.png. Is that even possible? An example would be helpful.

1 ACCEPTED SOLUTION

avatar
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login
4 REPLIES 4

avatar
hide-solution

This problem has been solved!

Want to get a detailed solution you have to login/registered on the community

Register/Login

avatar
Super Collaborator

Did not work for me. The special point is that I need the following pattern to be accepted "*://*:*/logo.png" I don't want it under **/myservice

avatar

Unfortunately that isn't going to work, at least not the way you are thinking about it. There are a few reasons for this. The first is that each topology file is deployed within the server "under the covers" as a JEE WAR. In particular it is deployed on a context path made up of the value of gateway.path in gateway-site.xml and the name of the topology file. So all of the URLs will start with {gateway.path}/{topology} no matter what. Beyond that each service or app generally then carves out a unique subcontext to avoid collisions.

avatar

However, the way you need to be thinking about this is to rewrite the URL in the outbound response in which it is contained. This is certainly more complex but you can find some examples of how to do this in the HBase integration in data/services/hbase/0.98.0. It involves the use of filters on the outbound response bodies.