gregorwolf / hanatrial-auth-proxy

SAP HANA Cloud Authentication Proxy for HANA XS
Apache License 2.0
22 stars 8 forks source link

HTTP(S) Proxy support #2

Open simfer opened 9 years ago

simfer commented 9 years ago

Just for testing I’ve create a very simple table on Hanatrial named Employees and I’ve converted it to a service which I can reach successfully using the URL: https://s6hanaxs.hanatrial.ondemand.com/i045523trial/dev/empdemo/services.xsodata/$metadata image

Now, I want to use this from SAP Web IDE, so I downloaded your proxy app which I configured in the following way: image

I’m able to start the server: image

However when I try to use the link: http://localhost:7891/i045523trial/dev/empdemo/services.xsodata/$metadata I’m prompted for credentials and I enter my SCN ones:

image

After this the page is not loaded and I get the following error in the Terminal window: image

Do you have any idea about why I get this problem? Are you able to help me to debug this issue? I’ve also tried with another service like: https://s1hanaxs.hanatrial.ondemand.com/s0002687731trial/opensap/perslist/services/pers.xsodata/$metadata but I’ve got the same results.

Thanks and regards, Simmaco

gregorwolf commented 9 years ago

Hi Simmaco,

the error message getaddrinfo looks to me first like a problem with the DNS lookup of s6hanaxs.hanatrial.ondemand.com. Please check with a ping at least the FQDN is translated in an IP Address. For me it resolves to 155.56.219.22.

Best regards Gregor

simfer commented 9 years ago

Hi Gregor, I finally found the culprit! Since I was testing it from within the SAP network, it was not working. As soon as I disconnected from the VPN it started working. It seems that this tool is not able to work from behind a firewall. Do you know how to make it working behind a proxy? Thanks and regards, Simmaco

gregorwolf commented 9 years ago

Hi Simmaco, in the moment there is no built in support for proxies. I've added it to the TODO section of the readme. Feel free to fork and add this feature :-). Regards Gregor

gregorwolf commented 9 years ago

Hi Simmaco, please check the commit c568745c2c4a3484693fa1952254688d572ac3be it should now also work with proxies. Best regards Gregor

mlenkeit commented 9 years ago

@simfer You will need to maintain the environment variables HTTP_PROXY and HTTPS_PROXY when you're behind a firewall.

gregorwolf commented 9 years ago

@mlenkeit you might have seen that in the config.js there is an option for proxy. Have you tried and does the request module also supports the environment variables?

mlenkeit commented 9 years ago

@gregorwolf as per the docs of the request module, it supports the environment variables:

The following environment variables are respected by request: (src)

  • HTTP_PROXY / http_proxy
  • HTTPS_PROXY / https_proxy
  • NO_PROXY / no_proxy

/cc @simfer

gregorwolf commented 9 years ago

OK, I will give it a try later this evening. I would guess that we then have two options. Via the config file and via environment variables.

Finkes commented 9 years ago

Did you get it to work with HTTP_PROXY / HTTPS_PROXY? I couldn't and I'm behind a Corporate Proxy as well.

amysy commented 9 years ago

Hi Gregor-

I was running server-basic-auth.js and encountered following issues. C:\Users\Amy\hanatrial-auth-proxy>node service-basic-auth.js module.js:338 throw err; ^ Error: Cannot find module 'C:\Users\Amy\hanatrial-auth-proxy\service-basic-auth. js' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3 I tried running this download from the dir where i've node.js libraries but didn't work. also tried couple other things such as npm init, and rebuild. but same error is coming up. I'm also wondering since I've no use for a proxy connection can I jump to cloud connector directly and continue. . Note: I already made changes to config.js as required. Suggest.

gregorwolf commented 9 years ago

Hi amysy,

please try to run:

node server-basic-auth.js

from the examples folder. Also you should open a new issue when the topic is not related to an existing issue.

Best regards Gregor

amysy commented 9 years ago

Thanks Greg for your attention.

Issue is resolved by another work around.

Sent from my iPhone

On Aug 20, 2015, at 4:01 PM, Gregor Wolf notifications@github.com wrote:

Hi amysy,

please try to run:

node server-basic-auth.js from the examples folder. Also you should open a new issue when the topic is not related to an existing issue.

Best regards Gregor

— Reply to this email directly or view it on GitHub.