Changing the hostname for an internal redirect

thumbs_up_ico0thumbs_down_ico0

I am having a strange little issue. I created an action that send the user to another Web Screen within the eSpace when its work is done. It uses a piece of JavaScript to direct to the new location, and the location includes the hostname. The problem is, the hostname is not the hostname that I need it to be. It is the correct hostname that the site was called with, but because the Platform Server is behind a reverse proxy, I need the hostname to either be relative, or I need it to be drawn from the hostname setting for the Platform Server. Because the script contents are in the script tag's value (as opposed to an attribute), the IIS URL Rewrite module is unable to edit the contents as needed.

I am certainly willing to try a workaround, but I want one that is elegant and does not need manual intervention as my server topology changes (ie: not simply creating an external site link for the internal Web Screen and pointing the workflow there).

Any help would be much appreciated, thanks!

J.Ja

thumbs_up_ico0thumbs_down_ico0
Hi Justin,

Have you tried a relative URL (e.g. /espace/webscreen.aspx instead of http://server/espace/webscreen.aspx)?

Cheers,
Tiago Simões
thumbs_up_ico0thumbs_down_ico0
That would work if I had the opportunity to actually type anything in. I've got a "GoToUrl" action which I made myself (it just uses something else which allows me to set the HTTP status so I can redirect), but I'm not using it here because I do not want to hard code the URL in. Instead, I am ending the Action with a connector to another Web Screen. That's what's causing the JavaScript redirect with the FQDN.

J.Ja
thumbs_up_ico0thumbs_down_ico0
What piece of JavaScript are you using?
Are you running that action in Ajax or is it a Submit?
Can you post a small sample to show your problem?

Cheers,
Tiago Simões
thumbs_up_ico0thumbs_down_ico0
I didn't write the JavaScript. The JavaScript is generated by the Platform Server, that is how it handles using a Web Screen as an endpoint for an action. The action is in a submit.

I've attached a screenshot of what I am talking about, to help explain the issue. I am doing things the "right way".

J.Ja
thumbs_up_ico0thumbs_down_ico0
In that case you are doing a POST and I think it will then work as a server transfer in .NET.
What's the platform JavaScript you are referring to?
thumbs_up_ico0thumbs_down_ico0
I am not writing any JavaScript or deliberately using any JavaScript. The JavaScript is being written by the Platform Server to perform the transfer. It is most definitely not doing Server.Transfer on the ASP.NET end of things. I have not written or added a single line of JavaScript to this application.

J.Ja
thumbs_up_ico0thumbs_down_ico0
Got it. I was just wandering what Platform JavaScript were you referring to.

Attached is a very simple sample with the transfer behavior as I understood it (which might be wrong).
Where are you seeing those absolute paths that are messing with your reverse proxy? 
thumbs_up_ico0thumbs_down_ico0
Yup, that sample is 100% correct!

The output from that sample is going to create HTML output which has some JavaScript on it. The JavaScript will follow this approximate format:

<script>
<![CDATA[
Blah blah blah
Redirect to http://servername/eSpaceName/WebScreenName.aspx
Blah blah blah
]]>
</script>

Because the URL is *not* in an attribute of a tag, the IIS Rewrite Module is unable to change it in the output rule. That server name in the redirect is *not* coming from the configuration in Service Center (I tried changing it). If I had a guess, it is coming from the HTTP_HOST server variable.

J.Ja
thumbs_up_ico0thumbs_down_ico0
Strange...
I've seen the source of the pages of the attached eSpace and I did not find the script you are referring to...

What IIS Rewrite module are you using? Are you using the new SEO URLs of Agile Platform 5.1?

Cheers,
Tiago Simões
thumbs_up_ico0thumbs_down_ico0
I think I found it. Check out this thread on reverse proxies and IIS rewrite module:

http://stackoverflow.com/questions/42937/url-rewrite-module-for-iis-7


Cheers,
Tiago Simões
thumbs_up_ico0thumbs_down_ico0
I am actually using the IIS URL Rewrite module. It is performing a reverse proxy, because I have the Platform Server machine sitting behind another machine. Requests come into my main Web server, then go through the reverse proxy to pull from the Agile Platform machine on the backend.

You will not see the script in the source, because by the time you see anything, the browser has been redirected. To see the system in action, you need to use something like Fiddler or Mocrosoft Networking Monitor and inspect the full HTTP conversation. If you do that, you'll see the JavaScript and the redirection. Sorry, I should have mentioned that a while ago!

J.Ja
thumbs_up_ico0thumbs_down_ico0
Hi Justin,

Sorry, I've done that and I still can't find any reference to a host in JavaScript (only for Ajax requests).
Are you sure you are talking about Submit requests?
Could you post a bit more of the script you think it is causing this problem?

Cheers,
Tiago Simões

thumbs_up_ico0thumbs_down_ico0
Ah, you are correct! It is indeed using an Ajax submission!

I swapped it for a non-AJAX submit, and it works like a charm. I looked at the actions, and I was using an AJAX Refresh as part of the screen, but there was no really good reason for it. I removed it and retested, and everything is still good.

Thank you so VERY much for your help on this!

J.Ja
thumbs_up_ico0thumbs_down_ico0
Hi guys, 

I'm currently stuck with the same problem Justin mentioned here. From what I understand from your latest post Justin, you worked around the problem by changing all of your ajax submits to non-ajax submits. 
In my case, I actually need the ajax submits and your workaround is not feasible. Is there any solution for this problem?

Thanks,
Jorge
thumbs_up_ico0thumbs_down_ico0
Jorge -

Unfortunately, I never found another resolution... it's been a while since I did this piece of work (nearly 2 years!).

J.Ja
thumbs_up_ico0thumbs_down_ico0
Tiago,

How about on your side, is there any solution Outsystems suggests? What makes the ajax and non-ajax submits work differently in this instance and how can we build a reverse proxy rules to make the submit redirect to the url we want?

Thanks,
Jorge
thumbs_up_ico0thumbs_down_ico0
Hi Jorge,

I'm not sure of the effect of the reverse proxies rules in Ajax calls. Do you really need those rules, can't you use the Platform SEO URLs instead? If there is no way you can workaround this issue I would suggest you to contact OutSystems Technical Support with some more context information.

Cheers,
Tiago Simões