I couldn't find configuration option for using proxy in Find indexing, is there one? Or has someone created workaround to this "problem"?
I guess you could just specify it the default way in Web.config or through Internet Options.
The DefaultWebProxy property reads proxy settings from the app.config file. If there is no config file, the current user's Internet Explorer (IE) proxy settings are used.
You are right, my first day after vacation so was a bit lazy to check that :-)
Is there any other way to do this, if you dont want to set defaultwebproxy?
Is there any other way to do this, if you don't want to set defaultProxy in web.config, since this is a global setting for the whole webapp?
Find by default uses the System.Net.HttpWebRequest and therefore follows any proxy rules for the application. You can write your own request handler by overloading IJsonRequest but I would not recommend that in this case. Insted I would say that you simply set the bypass-list in the defaultProxy setting to anything but the Find connection string (see: <defaultProxy> Element)
We tried overloading IJsonRequest using the ServiceConfiguration attribute but it didn't work unfortunately. So I'm guessing we're left with using the bypasslist or a proxy PAC.
The Find Core Api (EPiServer.Find.dll) does not use the service locator. You have to wrap it into IJsonRequestFactory -> pass it into new Commands(serviceUrl, new CustomJsonRequestFactory(), Serializer.CreateDefault, new RuntimeCacheAdapter()); -> and create the client using -> Client(ICommands commands, string defaultIndex) if you want to go down that road.
Will give this a try, thanks!
I would really recommend you to go with the defaultProxy config change with a bypass-list. Replacing the entire JsonRequest, creating a custom client and injecting it at startup (as other components are using the service locator to use/configure the client) is a lot of work for just having a custom proxy setting for the http requests of Find.
You can of course also set/create the default proxy in code by implementing the IWebProxy interface and set it for WebRequest.DefaultWebProxy./Henrik
Yes I agree, it seems like a lot of work.
However, I don't understand what you mean with your last sentence. How would that help? Our site has a lot of internal webrequests where using defaultproxy for the whole app renders that functionality unusable. We could of course specify in code that a proxy shouldn't be used per every request we're making. That would not be our preferred solution in this case.