Question: visualforce page refresh

Skylar: 2 weeks ago

I want to refresh a visualforce page on submission of a form, adding an additional query string parameter, but when I try and get the current page url it returns the /apex/controllerName route rather than the name of the page on the public facing site.

private String hostName = ApexPages.currentPage().getHeaders().get('Host');

private String url = ApexPages.currentPage().getURL();

private String thisPageUrl = 'https://' + hostName + '/' + url + '&submitted=true';

return new PageReference(thisPageUrl);

I want this to return in format: http://

but currently I get: https://

Natalia: 2 weeks ago

You should be using Site.getBaseUrl() instead of the Host parameter. See the Site ( class for more information.