$_SERVER variables with NodeJS on Windows Box

Hi all

I have the following SERVER variables set in my ‘globals’ Server Action but they’re not all displaying data:

image

I’m guessing it’ll have something to do with the header settings in IIS on the server, all I’m trying to do right now is capture the users IP address server side but the usual REMOTE_ADDR is not working. The only items working above list are:
HTTP_REFERRER
HTTP_USER_AGENT
SERVER_URL

Has anyone else seen this issue?

This is borderline impossible :laughing:

Can you do a Set Value with the expression $_SERVER? (so it outputs all variables)

Note “is not working” is different than “is showing some other unexpected value”. If it’s showing an incorrect IP address, the reverse proxy (IIS?) needs to be configured to pass the real IP address in a header, and NodeJS should be configured (don’t know how) to accept that

I said in the original request they weren’t returning any data. Nothing appears. I was under the impression that NodeJS would pass the header info to IIS - Looks like I’m incorrect.

As far as I can see, theres no way to see a list of what is actually returned, I tried the set value like you suggested but just got [object][object] output.

Can you (or anyone else) think of a way to find out what variables are actually being used? Similar to PHP?


If unable to replicate, this might be a bug and you should reveal every detail about your NodeJS installation (version) and stuff. $_SERVER.REMOTE_ADDR should always be present, even if there’s something misconfigured

1 Like

@Apple thanks for that help there, looks like I may have an issue somewhere. I’ll dig deeper and report back what it is in case anyone else has this.

@Apple Just one more thing, what happens when you click the ‘define schema’ button? Do you have a schema there already?

Hi TMR,

My schema is empty, that’s just for the Wappler UI - metadata - it doesn’t affect execution in any shape or form

When you defined those $_SERVER variables in your Globals, those are just metadata to aid you in Wappler UI and don’t have any influence in the execution

1 Like

Well, it turns out this wasn’t a bug with Wappler but a quirk of iisnode on IIS server. If anyone else out there has any issue with not retrieving a user IP address running NodeJS on a Windows server then you need to add this to your webconfig file:

<iisnode enableXFF="true" />

In the context of the webconfig file itll look like this:

<configuration>
  <system.webServer>

    <!-- ... -->

    <iisnode enableXFF="true" />

  </system.webServer>
</configuration>

More info is here: