1

i have a simple XPage and i access it through an reverse proxy. My problem is now to get the correct URL on server side.

context.getUrl().toString()

and

    XSPContext xspContext = new ServletXSPContextFactory().getXSPContext(FacesContext.getCurrentInstance());
    XSPUrl xspUrl = xspContext.getUrl();
    return xspUrl.toString();

did not work correct.

For example:

URL in the Browser is https://myip/db.nsf

But the SSJS function as well as the Java function returns just http://myip/db.nsf

When i try this without a reverse proxy, everything work fine. Is there a way to get location.href on server side?

Pudelduscher
  • 359
  • 3
  • 18

4 Answers4

0

You can use the following code to create the URL manually:

 var path = facesContext.getExternalContext().getRequest().getContextPath()
 var url = "https://" + path 

This will return the path to your nsf-file with the https prefix

PoisonedYouth
  • 548
  • 3
  • 16
  • The problem is, that not always the url is with an https. So to set it manually is not a solution for me. – Pudelduscher Oct 28 '14 at 12:28
  • facesContext.getExternalContext().getRequest().getRequestURL() will return the full url within the xsp part. If you cut off the right part (including the slash) of the last slash you get the url – PoisonedYouth Oct 28 '14 at 12:34
  • That is true, but i have to add the https and the domain manually and this did not work for me because the protocoll and the domain is not fixed. I need to get it from the bowser dynamically like location.href – Pudelduscher Oct 28 '14 at 12:40
  • What do you get if you use facesContext.getExternalContext().getRequest().getRequestURL() in your code? – PoisonedYouth Oct 28 '14 at 13:32
0

Hmm... this may be an administrative setting: with an internet site document you can additionally create a website rule (type = substitution) to automatically compute the whole URL by the incoming pattern. Have a look at the IBM Domino administration help on how to setup a site document as well as a web site rule. The goal is to get both URLs to have the same scheme so that XSP computation will result in correct values dynamically.

Oliver Busse
  • 3,375
  • 1
  • 16
  • 26
  • Yes, i think also this is an administrative problem. But this is a very large and complex environment and i would love to get a solution that i could use without any administrative changes. I can't beleve there is a way to get the value from the browser and i mean without parse it onload from clientside-js to a sessionScope variable – Pudelduscher Oct 28 '14 at 12:46
0

I believe what you want is to set the $WSIS header from the reverse proxy to Domino to True. Much like the other WebSphere connector headers, this should cause Domino to think that the incoming protocol is HTTPS in all situations. Note that this also has the unfortunate side effect of causing Domino to revert to its behavior of only using one Site document per IP; if you've been taking advantage of the reverse proxy to avoid this bug, you will have to find another route, such as looking for an X-SSL header from the proxy.

Jesse Gallagher
  • 4,461
  • 13
  • 11
0

Unless you want to send out links to other places, you don't need the protocol part. If you are on the same browser //someserver/somepage will link to a different server using the currently used protocol. Other than that the proxy probably set a header.

stwissel
  • 20,110
  • 6
  • 54
  • 101