Re: need help for a rewrite rule
Thanks Billy ! I've adapted your example and that works Le mar. 31 juil. 2018 à 19:52, Watson, Billy a écrit : > One of the best examples of what you need is in the ambari UI config in > github. > > > > > https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambariui/2.2.0/rewrite.xml > > > https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambariui/2.2.0/service.xml > > > > Match on the whole string and then apply the gateway path. Assuming that a > leading slash won’t break things (it usually is neutral or even helps), > then you can do something like this: > > > > pattern="static/schema_fields.json"> > > > > > > > > That’s the most basic way. You may want to limit this to your javascript > portion. If you do, you’ll need to add a filter and then add that filter to > the service.xml. > > > > The most helpful docs for me were: > > > > http://kminder.github.io/knox/2015/11/16/adding-a-service-to-knox.html > > > https://cwiki.apache.org/confluence/display/KNOX/2017/08/14/Understanding+Rewrite+Rules+for+Apache+Knox > > https://cwiki.apache.org/confluence/display/KNOX/Proxying+a+UI+using+Knox > > > > > > *Billy Watson* > > > > > > *From: *David Morin > *Reply-To: *"user@knox.apache.org" > *Date: *Monday, July 30, 2018 at 5:47 PM > *To: *"user@knox.apache.org" > *Subject: *need help for a rewrite rule > > > > Hello, > > > > I've got this url: > > > > > https://knox./gateway/default/logsearch/scripts/collections/SchemaFieldList.js?ver=build.version > > > > *that contains this:* > > > > return Backbone.Collection.extend({ > > model: SchemaField, > > url: 'static/schema_fields.json' > > }); > > > > *And I'd like to replace by:* > > > > return Backbone.Collection.extend({ > > model: SchemaField, > > url: '*logsearch*/static/schema_fields.json' > > }); > > > > because at the moment, I've got a 404. The url called by the browser is > this one: > > https://knox./gateway/default/static/schema_fields.json > > > > What is the best way to handle this rewriting ? > > > > Thanks in advance > > David >
Re: need help for a rewrite rule
One of the best examples of what you need is in the ambari UI config in github. https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambariui/2.2.0/rewrite.xml https://github.com/apache/knox/blob/master/gateway-service-definitions/src/main/resources/services/ambariui/2.2.0/service.xml Match on the whole string and then apply the gateway path. Assuming that a leading slash won’t break things (it usually is neutral or even helps), then you can do something like this: That’s the most basic way. You may want to limit this to your javascript portion. If you do, you’ll need to add a filter and then add that filter to the service.xml. The most helpful docs for me were: http://kminder.github.io/knox/2015/11/16/adding-a-service-to-knox.html https://cwiki.apache.org/confluence/display/KNOX/2017/08/14/Understanding+Rewrite+Rules+for+Apache+Knox https://cwiki.apache.org/confluence/display/KNOX/Proxying+a+UI+using+Knox Billy Watson From: David Morin Reply-To: "user@knox.apache.org" Date: Monday, July 30, 2018 at 5:47 PM To: "user@knox.apache.org" Subject: need help for a rewrite rule Hello, I've got this url: https://knox./gateway/default/logsearch/scripts/collections/SchemaFieldList.js?ver=build.version that contains this: return Backbone.Collection.extend({ model: SchemaField, url: 'static/schema_fields.json' }); And I'd like to replace by: return Backbone.Collection.extend({ model: SchemaField, url: 'logsearch/static/schema_fields.json' }); because at the moment, I've got a 404. The url called by the browser is this one: https://knox./gateway/default/static/schema_fields.json What is the best way to handle this rewriting ? Thanks in advance David
need help for a rewrite rule
Hello, I've got this url: https://knox./gateway/default/logsearch/scripts/collections/SchemaFieldList.js?ver=build.version *that contains this:* return Backbone.Collection.extend({ model: SchemaField, url: 'static/schema_fields.json' }); *And I'd like to replace by:* return Backbone.Collection.extend({ model: SchemaField, url: '*logsearch*/static/schema_fields.json' }); because at the moment, I've got a 404. The url called by the browser is this one: https://knox./gateway/default/static/schema_fields.json What is the best way to handle this rewriting ? Thanks in advance David