You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Osman Zakir <os...@hotmail.com> on 2019/01/14 15:24:33 UTC

[users@httpd] About Using ProxyPass Directive

The application I want to deploy behind the reverse proxy is in the E:\programming\visual_studio_2017\Projects\currency_converter\x64\Release directory on my computer, and I got a free subdomain from https://www.subdomain.com which forwards to my external IP address which I got from searching "my ip" in my browser.  The URL for it is https://dragonscurrencyconv.com.nu.  Right now it won't get to the app at all because although I've set up port forwarding, my app still can't talk to the Internet publicly.  I want to try setting up a reverse proxy again.

The front-end JavaScript code in my app sends a GET request to the server code I wrote in C++ that asks for the currency API access key so it can use it to get the list of currencies.  The path URI for the access key is "/?q=accesskey".  I want to configure this on the ProxyPass as well so that it'd route to reverse proxy server correctly.  Right now my reverse proxy configuration looks like this:

"
<Directory "E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release">
Options All​
Options Indexes FollowSymLinks​
    AllowOverride None​
    Require all granted​
</Directory>​
​
<VirtualHost *:8000>​
    ServerAdmin osmanzakir90@hotmail.com​
    ServerName dragonscurrencyconv.com.nu​
ServerAlias www.dragonscurrencyconv.com.nu​
    ErrorLog "logs/dragonscurrencyconv.com.nu-error.log"​
    CustomLog "logs/dragonscurrencyconv.com.nu-access.log" common​
</VirtualHost>​
​
ProxyPass "/" "E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release"​
ProxyPass "/?q=accesskey"
"

Should I put the same path as for the first ProxyPass directive, for the "/" route, for the accesskey route as well, or is that one also wrong?  What would the correct one be if so?  My app's source code is all on GitHub, here: https://github.com/DragonOsman/currency_converter.  Any help would be appreciated.  Thanks in advance.
[https://avatars0.githubusercontent.com/u/18173932?s=400&v=4]<https://github.com/DragonOsman/currency_converter>

GitHub - DragonOsman/currency_converter: Application for Computer Science course<https://github.com/DragonOsman/currency_converter>
Google Maps + Currency Converter Web Application. Application for Computer Science course. This is a currency converter web application with the frontend and a backend.
github.com



[users@httpd] Re: About Using ProxyPass Directive

Posted by Osman Zakir <os...@hotmail.com>.
Adding to previous message: I set up port forwarding on ports 8080 (for HTTP) and 8443 (for HTTPS) for my internal IP address on my router and I also put in my IP address for the DMZ host.

Just now when I tried to start httpd as a service (I had to do it as an Administrator because I was getting "Access is denied" errors otherwise), I got this message:
"
[Tue Jan 15 01:42:46.023403 2019] [env:warn] [pid 10636:tid 500] AH01506: PassEnv variable <Google API Key value here> was undefined
[Tue Jan 15 01:42:46.027402 2019] [env:warn] [pid 10636:tid 500] AH01506: PassEnv variable <currencylayer.com access key value here> was undefined​
AH00526: Syntax error on line 556 of C:/Apache24/conf/httpd.conf:​
ProxyPass URL must be absolute!: E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release
"

I hid the values of the environment variables here because they're API keys.  I've set them using the PassEnv directive like this:
"
PassEnv apikey "<Google API Key value here>"
PassEnv accesskey "<currencylayer.com access key value here>"
"

Did I do it wrong?  If so, please help me fix it.

And why is it (as I interpret it) saying that the URL is not absolute?  The application I want to deploy behind the reverse proxy is at that location on my computer.  Do I need to use the DDNS subdomain URL I got, or is there something else I'm missing?  If I give it the DDNS subdomain URL, how will it know where the app's files are on my computer?  Or do I need to start the application server (the C++ executable program is also a web server) before starting the Apache httpd?

Re: [users@httpd] About Using ProxyPass Directive

Posted by Eric Covener <co...@gmail.com>.
>
> I put in the path to where the executable file that's also the web server
> is.
>

That won't accomplish anything, a URL is required.

Re: [users@httpd] About Using ProxyPass Directive

Posted by Eric Covener <co...@gmail.com>.
On Tue, Jan 15, 2019 at 9:47 AM Osman Zakir <os...@hotmail.com> wrote:
>
> I still get these warnings when I try run Apache:
> "
> [Tue Jan 15 19:38:22.300249 2019] [env:warn] [pid 12988:tid 556] AH01506: PassEnv variable <apikey> was undefined
> [Tue Jan 15 19:38:22.301248 2019] [env:warn] [pid 12988:tid 556] AH01506: PassEnv variable <accesskey> was undefined
> "

PassEnv doesn't take a value. It takes 1 or more native environment
variable names. They should already have the value you want in the
environment that launches apache.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] About Using ProxyPass Directive

Posted by Osman Zakir <os...@hotmail.com>.
I still get these warnings when I try run Apache:
"
[Tue Jan 15 19:38:22.300249 2019] [env:warn] [pid 12988:tid 556] AH01506: PassEnv variable <apikey> was undefined
[Tue Jan 15 19:38:22.301248 2019] [env:warn] [pid 12988:tid 556] AH01506: PassEnv variable <accesskey> was undefined
"

How do I set the PassEnv value correctly?  Right now it's like this:
"
PassEnv apikey "<apikey_value>"
PassEnv accesskey "<accesskey_value>"
"

Is that wrong? Note: I'm not putting the actual API keys here.  They're just placeholders.

By the way, it's good to put the ServerName in httpd.conf as something other than the actual name of the server app I want to put behind the reverse proxy, right?  Or would it be better to give it the same name as the actual app?
________________________________
From: Jonathon Koyle <li...@gmail.com>
Sent: Tuesday, January 15, 2019 6:47 PM
To: users@httpd.apache.org
Subject: Re: [users@httpd] About Using ProxyPass Directive

By default, the httpd.conf has the directive Listen 80.  If you don't want Apache to listen on 80 you will need to remove/change it.  You are allowed to have as many listen directives as you want Apache to bind.  ServerName does not usually include a port, and does not specify what IP or port Apache binds to.

On Tue, Jan 15, 2019, 06:28 Osman Zakir <os...@hotmail.com> wrote:
@Eric Covener <ma...@gmail.com> I got the port forwarding to work and am now able to get my app using my external IP address on port 8443 (but it's not using SSL right now).  I still need to actually get Apache to start before I put my app behind the reverse proxy, and port 80 is being used by the system.  I tried to change the "ServerName" value to 0.0.0.0:8080<http://0.0.0.0:8080>, but it's still trying to connect on 0.0.0.0:80<http://0.0.0.0:80> which is giving an about it not being able to bind to any listening ports.  I'll see if I can find another setting in the httpd.conf file to use in the meantime, but for now I'll also ask this: what do you suggest I do?

Re: [users@httpd] About Using ProxyPass Directive

Posted by Jonathon Koyle <li...@gmail.com>.
By default, the httpd.conf has the directive Listen 80.  If you don't want
Apache to listen on 80 you will need to remove/change it.  You are allowed
to have as many listen directives as you want Apache to bind.  ServerName
does not usually include a port, and does not specify what IP or port
Apache binds to.

On Tue, Jan 15, 2019, 06:28 Osman Zakir <osmanzakir90@hotmail.com wrote:

> @Eric Covener <co...@gmail.com>I got the port forwarding to work and am
> now able to get my app using my external IP address on port 8443 (but it's
> not using SSL right now).  I still need to actually get Apache to start
> before I put my app behind the reverse proxy, and port 80 is being used by
> the system.  I tried to change the "ServerName" value to 0.0.0.0:8080,
> but it's still trying to connect on 0.0.0.0:80 which is giving an about
> it not being able to bind to any listening ports.  I'll see if I can find
> another setting in the httpd.conf file to use in the meantime, but for now
> I'll also ask this: what do you suggest I do?
>

Re: [users@httpd] About Using ProxyPass Directive

Posted by Osman Zakir <os...@hotmail.com>.
@Eric Covener <ma...@gmail.com> I got the port forwarding to work and am now able to get my app using my external IP address on port 8443 (but it's not using SSL right now).  I still need to actually get Apache to start before I put my app behind the reverse proxy, and port 80 is being used by the system.  I tried to change the "ServerName" value to 0.0.0.0:8080, but it's still trying to connect on 0.0.0.0:80 which is giving an about it not being able to bind to any listening ports.  I'll see if I can find another setting in the httpd.conf file to use in the meantime, but for now I'll also ask this: what do you suggest I do?

Re: [users@httpd] About Using ProxyPass Directive

Posted by Osman Zakir <os...@hotmail.com>.
From: Eric Covener <co...@gmail.com>
Sent: Tuesday, January 15, 2019 7:00 AM
To: users@httpd.apache.org
Subject: Re: [users@httpd] About Using ProxyPass Directive



ProxyPass "/" "E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release"

>The 2nd parameter should be a URL where your backend service is listening for HTTP requests, but you put a path to where you >compiled some binaries.
>Those are not interchangeable.

>If there's no URL where your currency converter works, you won't get any benefit of setting up a reverse proxy.

I put in the path to where the executable file that's also the web server is.  That's the docroot, since it's also where the static assets are.  As for a URL where it works, it's only my internal IP so far.

In my router's settings, under NAT > Virtual Servers, I have these two rules for the port forwarding:
Server Name     External Port Start     External Port End       Protocol        Internal Port Start     Internal Port End       Server IP Address       WAN Interface   LAN Loopback    Enable/Disable  Remove
 Secure Web Server (HTTPS)       8443    8443    TCP     8443    8443    192.168.10.9    ppp2.1 Disabled
 HTTP    8080    8080    TCP     8080    8080    192.168.10.9    ppp2.1 Disabled


192.168.10.9 is my internal IP address.  I'll try again after setting my server app first and then Apache, but for now, does this look okay to you?

Re: [users@httpd] About Using ProxyPass Directive

Posted by Eric Covener <co...@gmail.com>.
ProxyPass "/"
> "E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release"
>

The 2nd parameter should be a URL where your backend service is listening
for HTTP requests, but you put a path to where you compiled some binaries.
Those are not interchangeable.

If there's no URL where your currency converter works, you won't get any
benefit of setting up a reverse proxy.

[users@httpd] RE: About Using ProxyPass Directive

Posted by "Muggeridge, Matt" <ma...@hpe.com>.
Ø  ProxyPass "/?q=accesskey"

From the ProxyPass documentation, it states:

url is a partial URL for the remote server and cannot include a query string.

If you must use a query string then presumably you will need the more flexible RewriteRule directive with the [P] flag.

Matt.

From: Osman Zakir [mailto:osmanzakir90@hotmail.com]
Sent: Tuesday, 15 January 2019 1:25 AM
To: users@httpd.apache.org
Subject: [users@httpd] About Using ProxyPass Directive

The application I want to deploy behind the reverse proxy is in the E:\programming\visual_studio_2017\Projects\currency_converter\x64\Release directory on my computer, and I got a free subdomain from https://www.subdomain.com which forwards to my external IP address which I got from searching "my ip" in my browser.  The URL for it is https://dragonscurrencyconv.com.nu.  Right now it won't get to the app at all because although I've set up port forwarding, my app still can't talk to the Internet publicly.  I want to try setting up a reverse proxy again.

The front-end JavaScript code in my app sends a GET request to the server code I wrote in C++ that asks for the currency API access key so it can use it to get the list of currencies.  The path URI for the access key is "/?q=accesskey".  I want to configure this on the ProxyPass as well so that it'd route to reverse proxy server correctly.  Right now my reverse proxy configuration looks like this:

"
<Directory "E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release">
Options All​
Options Indexes FollowSymLinks​
    AllowOverride None​
    Require all granted​
</Directory>​
​
<VirtualHost *:8000>​
    ServerAdmin osmanzakir90@hotmail.com<ma...@hotmail.com>​
    ServerName dragonscurrencyconv.com.nu​
ServerAlias www.dragonscurrencyconv.com.nu<http://www.dragonscurrencyconv.com.nu>​
    ErrorLog "logs/dragonscurrencyconv.com.nu-error.log"​
    CustomLog "logs/dragonscurrencyconv.com.nu-access.log" common​
</VirtualHost>​
​
ProxyPass "/" "E:/programming/visual_studio_2017/Projects/currency_converter/x64/Release"​
ProxyPass "/?q=accesskey"
"

Should I put the same path as for the first ProxyPass directive, for the "/" route, for the accesskey route as well, or is that one also wrong?  What would the correct one be if so?  My app's source code is all on GitHub, here: https://github.com/DragonOsman/currency_converter.  Any help would be appreciated.  Thanks in advance.
[https://avatars0.githubusercontent.com/u/18173932?s=400&v=4]<https://github.com/DragonOsman/currency_converter>

GitHub - DragonOsman/currency_converter: Application for Computer Science course<https://github.com/DragonOsman/currency_converter>
Google Maps + Currency Converter Web Application. Application for Computer Science course. This is a currency converter web application with the frontend and a backend.
github.com