Quick Apache question for X-Plane

For friendly off topic discussion not covered in a forum above.
Forum rules
No politics, please.
Shiunbird
Donor
Donor
Posts: 269
Joined: Fri May 06, 2016 1:43 pm
Location: Czech Republic

Quick Apache question for X-Plane

Unread postby Shiunbird » Tue Mar 14, 2017 8:49 am

Hey guys,

So I'm now flying the X-Plane 9 on my Quad G5 and enjoying it enormously. However, the live weather feature stopped working because the URL for the service changed:

From http://weather.noaa.gov/pub/data/observ ... atever.txt
To http://tgftp.nws.noaa.gov/data/observat ... atever.txt

If they would have kept the paths the same, I could have just updated my hosts file, but they wouldn't make it easy.

So I tried a few things on Apache (old 2.2, the one built in Mac OS 10.5), and updated my hosts file to try weather.noaa.gov against my own machine.

1. Redirect permanent /pub/data/observations/metar/cycles http://tgftp.nws.noaa.gov/data/observat ... tar/cycles.
Result: X-Plane doesn't understand the redirection and doesn't try the new URL.

2. ProxyRequests On
ProxyPassReverse /pub/data/observations/metar/cycles http://tgftp.nws.noaa.gov/data/observat ... tar/cycles
and
3. ProxyRequests On
ProxyVia On
RewriteEngine On
ReWriteCond %{HTTP_HOST} ^weather\.noaa\.gov$
ReWriteRule /pub(.*)$ http://tgftp.nws.noaa.gov/$1

And I get this (Apache log):
Tue Mar 14 16:14:25 2017] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 0 in child 1823 for worker proxy:forward
[Tue Mar 14 16:14:25 2017] [debug] proxy_util.c(1934): proxy: initialized single connection worker 0 in child 1823 for (*)
[Tue Mar 14 16:14:25 2017] [debug] proxy_util.c(1818): proxy: grabbed scoreboard slot 1 in child 1823 for worker proxy:reverse
[Tue Mar 14 16:14:25 2017] [debug] proxy_util.c(1934): proxy: initialized single connection worker 1 in child 1823 for (*)

It is clearly getting somewhere, because X-Plane downloads this from the tgftp.nws.noaa.gov server:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://tgftp.nws.noaa.gov//data/observations/metar/cycles/14Z.TXT">here</a>.</p>
</body></html>

I suspect my regexp re-writing the URL is bad, but I can't find it. Any tips? It has to be something stupid. =)

Thanks a ton!

Edit: This is the access log:
192.168.40.141 - - [14/Mar/2017:16:56:35 +0100] "GET /pub/data/observations/metar/cycles/14Z.TXT HTTP/1.1" 302 248

I'm not sure it shows the request before or after processing, I assume before.

User avatar
Elf
Donor
Donor
Posts: 73
Joined: Wed Oct 19, 2016 9:54 pm
Location: Pacific Northwest (US)

Re: Quick Apache question for X-Plane

Unread postby Elf » Tue Mar 14, 2017 9:50 pm

I would sort of expect something like:

Code: Select all

ProxyRequests On
ProxyPass /pub http://tgftp.nws.noaa.gov/data
ProxyPassReverse /pub http://tgftp.nws.noaa.gov/data

Without any need to use mod_rewrite.
:Indy: :Indy: :Indy: :Indigo2: :Indigo2IMP: :O2: :O2: :Octane: :Octane: :Fuel: :Tezro:
:Indy: [x19] :Indigo: [x7] :O2: [x4]

Shiunbird
Donor
Donor
Posts: 269
Joined: Fri May 06, 2016 1:43 pm
Location: Czech Republic

Re: Quick Apache question for X-Plane

Unread postby Shiunbird » Wed Mar 15, 2017 9:40 am

Elf wrote:I would sort of expect something like:

Code: Select all

ProxyRequests On
ProxyPass /pub http://tgftp.nws.noaa.gov/data
ProxyPassReverse /pub http://tgftp.nws.noaa.gov/data

Without any need to use mod_rewrite.


This did the trick:

Code: Select all

ProxyRequests On
ProxyPass /pub http://tgftp.nws.noaa.gov/
ProxyPassReverse /pub http://tgftp.nws.noaa.gov/

If I kept /data there, it would send over /data/data

Many thanks!!!

User avatar
Elf
Donor
Donor
Posts: 73
Joined: Wed Oct 19, 2016 9:54 pm
Location: Pacific Northwest (US)

Re: Quick Apache question for X-Plane

Unread postby Elf » Wed Mar 15, 2017 6:15 pm

Glad you got it working :)
:Indy: :Indy: :Indy: :Indigo2: :Indigo2IMP: :O2: :O2: :Octane: :Octane: :Fuel: :Tezro:
:Indy: [x19] :Indigo: [x7] :O2: [x4]

Shiunbird
Donor
Donor
Posts: 269
Joined: Fri May 06, 2016 1:43 pm
Location: Czech Republic

Re: Quick Apache question for X-Plane

Unread postby Shiunbird » Thu Mar 16, 2017 12:39 am

I forwarded the tip to some folks at the X-Plane forum.

To get this working they were using an hex editor to edit the executables to change where the program looks for the weather data (it is hard-coded).
Windows folks can't do this, because then anti-hackzors protection won't let you run the file anymore (especially if you got X-Plane from Steam).

Or, some guy created a java package with Apache proxy pre-configured and he sells it for 16 USD.


Return to “Everything Else”

Who is online

Users browsing this forum: No registered users and 2 guests