LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a 404 page with LabVIEW web services?

Solved!
Go to solution

well you can build your 404.html to redirect with a GET and pass original call as a parameter. Just a very initial thought, I have not tried to do it.

0 Kudos
Message 21 of 25
(611 Views)

@1984 wrote:

well you can build your 404.html to redirect with a GET and pass original call as a parameter. Just a very initial thought, I have not tried to do it.


I think the the request uri is already lost by the time the 404.html loads.  I believe the solution requires configuring the ErrorDocument funciton in AppWeb to populate a redirect_uri variable in the header or something other AppWeb configuration change.

 

  I'm new to the gorey details of web server configuration.  I'll keep plodding up the AppWeb configuration learning curve and see what I find.

0 Kudos
Message 22 of 25
(607 Views)

Yeah... I am not aware of the details either. But I know you can run your labview code in the case of the 404 error by doing the stuff above.

0 Kudos
Message 23 of 25
(600 Views)

Victory!    (EDIT: The smileys below should be a : followed by an o.  I don't see how to supress this conversion.  ) 

 

I modified the config file for the LabVIEW web server in a manner similar to Tanner B.  I added this line instead.

 

ErrorDocument 404 "/mywebservice/404?QUERY=${request:originalUri}"

 

This launches the 404.vi I created, with the original query appended.  

 

For example if one requests "/mywebservice/missingVI?param1=53&param2=xyz", the 404.vi is called and the REQUEST_URI request variable is populated correctly with "/mywebservice/404?QUERY=/mywebservice/missingVI?param1=53&param2=xyz".

 

 

I found the {request:originalUri} token in the AppWeb 5.0 documentation at http://appwebserver.org/products/appweb/doc/guide/appweb/users/routing.html  .   I used the 5.0 version of the documentation but I don't actually know which version is packaged with my LV version,  LV2013sp1.

 

 

I see three tokens which one might choose to pass as parameters to the 404.vi.  For my purposes I'm using {request:originalUri}.

 

{request:originalUri} - the entire uri (ie /mywebservice/missingVI?param1=53&param2=xyz)

{request:query} - only the parameters part of the uri (ie param1=53&param2=xyz)

{request:uri}  - only the part of the uri prior to parameters (ie /mywebservice/missingVI)

 

 

 thanks,

Martin

 

 

Message 24 of 25
(594 Views)

@mjaspan wrote:

(EDIT: The smileys below should be a : followed by an o.  I don't see how to supress this conversion.  ) 

 


The automatic conversion to an emoticon is something you can fix. It is a setting that causes the way the message is displayed to you to be messed up.

 

Dig through your profile settings for the forum. Under Preferences / Display, set your emoticon type to none. Now it won't automatically convert certain character combinations to smileys.

0 Kudos
Message 25 of 25
(569 Views)