0 votes
in Rock by DavidTurner (14.9k points)
edited

When viewing the LavaToPDF block as an administrator, it creates a message with a link indicating that if you were not an admin, you would of been redirected to different URL. The URL of that link does not get created correctly when Rock is behind a proxy. For example it adds a port 80 to the URL. How do you fix this?

1 Answer

+1 vote
by DavidTurner (14.9k points)
edited

I suspect this might be fixed in more recent versions of plugin, but Grace Church is still on v12 of Rock and there is no update available. To fix this you can replace this code in the \Plugins\com_mineCartStudio\Cms\LavaTPdf.ascx.cs file:

var uriBuilder = new UriBuilder( Request.Url );                 
var query = HttpUtility.ParseQueryString( uriBuilder.Query );
query["ViewDocument"] = "true";
uriBuilder.Query = query.ToString();

lMessages.Text += string.Format( @"<div class=""alert alert-warning"">If you did not have administrative access <a href=""{0}""> you would be shown this PDF.</a></div>", uriBuilder.ToString() );

With this code:

var queryParams = new System.Collections.Generic.Dictionary<string, string>();
queryParams.Add( "ViewDocument", "true" );
var url = GetCurrentPageUrl( queryParams );

lMessages.Text += string.Format( @"<div class=""alert alert-warning"">If you did not have administrative access <a href=""{0}""> you would be shown this PDF.</a></div>", url );
Welcome! Here you can ask questions and receive answers (hopefully) from other members of our team.
...