Jump to content
Welcome to our new Citrix community!

URL rewrite with custom ports


Michael B

Recommended Posts

Hi All.  I'm having trouble getting an expression to work correctly for me.  The issue is I have an application migrating from using port :8080 to now :8443 (SSL on the server).  So I put a responder policy on the VIP listening on 8080 to redirect to "https://servername:8443".  This is where it runs into problems.  Since the application has multiple templates that will send responses back to the user in the form of  "http://servername:8080/D2/?docbase=edmqa01&locateId=090132ea810575f1"   And the app admins don't want to have to change this.   So the responder policy wipes out the response.

 

I've tried using the expression "https://" + http.REQ.HEADER("Host").HTTP_HEADER_SAFE + ":8443" +  http.REQ.URL.PATH_AND_QUERY.HTTP_URL_SAFE

on the responder policy But that doesn't remove the :8080 in the original request and it ends up with :8080:8443 in the url and obviously breaks.

 

I'm thinking a rewrite policy would be the way to go evaluating the response, but cannot figure this one out.  Can the custom port in URL not be removed and/or changed?

 

Example of goal:

LB Vserver:   https://servervipname:8443/D2/?query

Server response  http://servervipname:8080/D2/?docbase=dkeeedhdh3  >>  Transform to  https://servervipname:8443/D2/?docbase=dkeeedhdh3

 

Any help is appreciated.

Link to comment
Share on other sites

Thanks Sam.  I was just over complicating it for some reason.  Must be end of the week.  That seems to work fine.  And of course the app admin left out some details, I thought this was occurring while in the application however it only puts in the old URL when the app sends out email links to files.  So Responder policy is the way to go here.

 

Cheers.

Link to comment
Share on other sites

Actually I did get it to work without hard coding the name.  For reference

"https://" + HTTP.REQ.HOSTNAME.BEFORE_STR(":8080") + ":8443" + HTTP.REQ.URL.PATH_AND_QUERY.HTTP_URL_SAFE

 

This does the trick.  It's been a while since I have worked with expressions and got stuck on looking at the header.

Thanks again.

 

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...