12-11-2021 09:35 AM
I think I'm missing something obvious.
Is there a way to get the headers of the request that invokes my app's web pages?
Perhaps there's some way to open a client handle to "this request"?
In particular, I'd like to know what the "Host:" header is, so I can know what host I'm running on.
Is there another way to do this?
Solved! Go to Solution.
12-15-2021 11:00 PM
Are you referring to the following scenario:
In that scenario the HOST that is used in the HTTP request is the same as what is shown in the URL for the current page. You can use the URL for WebVI library to get the parts of the URL for the page. The demo shows how the library can get the current URL of a page and parse and return the host portion of the URL.
12-16-2021 02:17 PM
Hi, Milan. Thanks for the response.
The VIs you linked to are indeed useful, but I'm not sure they solve my problem.
To answer your question, suppose I build an app called "MyWebApp" and install it in htdocs of the NI Web Server.
If I'm invoked as http://myserver.stravaro.com/MyWebApp, I'd like to have MyWebApp's code be able to know that it is running on "http://myserver.stravaro.com".
This information is part of the headers with which my web app is called, but I'm not sure how to retrieve those headers.
12-16-2021 02:41 PM
I spoke too soon. You have a VI named "Window Location Get.gvi" which does what I want. (Especially if I use it with "URL Get Parts.gvi".)
I really didn't expect the function to be named "Window Location Get.gvi". This seems like it should be referring to the window geometry in the GUI.
12-16-2021 03:22 PM
Ah yea, it was named pretty directly after the underlying JavaScript property that is being accessed, ie the location property of the window object. I can see how the name could be misconstrued for the window geometry 😋