Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: WSContext  (Read 7776 times)
Benjamin G.
Posts: 98


« on: June 16, 2022, 03:30:34 pm »

Hi,
documentation says :

How to retrieve web server information in a web service
With Genero Web services applications, environment variables cannot be used to pass HTTP request headers because the gwsproxy has already started. The only way to send the environment is through the HTTP header. Header names set by the GAS have the following form:

X-FourJs-Environment-Variable-MyHeaderName
...
Some variables transmitted by the Web server (Apache, IIS, etc.) are also available to the environment:

    X-FourJs-Environment-Variable-REMOTE_ADDR
    X-FourJs-Environment-Variable-REMOTE_USER
    X-FourJs-Environment-Variable-SERVER_NAME
    X-FourJs-Environment-Variable-HTTPS
...
        Set a context dictionary variable (for example context) at the modular level with the WSContext attribute. This allows you to retrieve all X-FourJs-Environment-xxx set by the GAS by referencing a dictionary key value, for example, DISPLAY context["Variable-REMOTE_ADDR"].

I've tried using Context Dictionnary and "Variable-xxx" keys are not present only this one :

 ---   1 BaseURL
 ---   2 RequestURL
 ---   3 Media
 ---   4 Host
 ---   5 User-Agent
 ---   6 Accept
 ---   7 Content-Type
 ---   8 Content-Length

Must we need to change some config in xcf files ?

Regards


Frank G.
Four Js
Posts: 48


« Reply #1 on: June 16, 2022, 04:17:49 pm »

Hi,

 Nothing to be done in the XCF file. The gas forwards the variables it gets from the web server. Try to activate the GAS logs and check if you find theses variables in the GWS proxy logs and in the Web services logs.

Frank
Reuben B.
Four Js
Posts: 1046


« Reply #2 on: June 20, 2022, 06:25:31 am »

Similar to the answer for your other forum post, are you running the web service from the command line, or are you running through GAS.

8 is number of parameters I expect when running from command line (a port number close to 8090). If I run through GAS/httpdispatch  (port number close to 6394 and xcf in the URL) then I see 2 extra parameters

Variable-REMOTE_ADDR
Variable-SERVER_NAME

I strongly suspect you are not going through a web server (httpdispatch is in effect a small web server)

Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Benjamin G.
Posts: 98


« Reply #3 on: June 20, 2022, 10:56:52 am »

Hello,

You are right, the test I was doing was under "Studio" with httpdispatch. With fastcgi it is ok

Thanks a lot for the answer.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines