function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
ollie123ollie123 

HTTP proxy page

Hi,

 

I want to display some content in my Visualforce app that is coming from an external server on a non-secure (HTTP) URL. I need to make that content accessible via an HTTPS proxy page in my app.

 

So I want to create a page like this: 

https://emea.salesforce.com/apex/page?param1=123  (not the HTTPS URL)

 

Which when accessed, delivers as its HTTP content that which is created by this:

http://www.domain.com/otherpage?param1=123   (note the non-HTTPS URL)

 

So whatever document is produced by the page on domain.com, I want that content to be output by my VF page. i.e. my VF page just passes the domain.com page content right through.

 

This would be very easy with ASP.NET, just make a GET request to the domain.com page, and render it out to the HTTP Response stream on "page". But how do I do it in VF?

 

RyanGuestRyanGuest

You can make a GET request with Apex that will return the source of the page. Have a look Apex's HTTP class: http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_classes_restful_http_httprequest.htm

 

 Another tip: make sure that you add the host that you're making the request to (www.domain.com) under the Remote Site Settings options in Salesforce. To do this go to Setup -> Security Controls -> Remote Site Settings