aboutsummaryrefslogtreecommitdiff
path: root/config/ddwrt.conf
blob: 3043c987a2b103c5a7eebbf327205a9a246a0ccc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
##################################
# ddwrt.conf
#
#    Reverse Proxy DD-wrt through Apache
#
#  Usage:
#
#    Use DDwrtProxyHTTP /ddwrt 192.168.1.1 www.andydoestech.com
#
#       ^---Makes dd-wrt accessble via http://www.andydoestech.com/ddwrt/
#
#    Use DDwrtProxyHTTPS /ddwrt 192.168.1.1 www.andydoestech.com
#
#       ^---Same as previous, except makes it accessible via https://www.andydoestech.com/ddwrt/
#
##################################


<Macro DDwrtProxyHTTP $proxypath $ddwrtip $domain>
  <Location $proxypath>
    ProxyPass http://$ddwrtip
    ProxyPassReverse http://$ddwrtip
    RequestHeader unset referer

    SetOutputFilter INFLATE;SUBSTITUTE;DEFLATE

    Substitute "s|return \"/ttgraph.cgi|return \"/local/gw/ttgraph.cgi|in"
    Substitute "s|src=\"/graph_if.svg|src=\"/local/gw/graph_if.svg|in"
  </Location>

  RewriteEngine On
  RewriteCond %{REQUEST_URI} $proxypath$
  RewriteRule ^(.*)$ http://$domain$proxypath/ [R,L]
</Macro>

<Macro DDwrtProxyHTTPS $proxypath $ddwrtip $domain>
  <Location $proxypath>
    ProxyPass http://$ddwrtip
    ProxyPassReverse http://$ddwrtip
    RequestHeader unset referer

    SetOutputFilter INFLATE;SUBSTITUTE;DEFLATE

    Substitute "s|return \"/ttgraph.cgi|return \"/local/gw/ttgraph.cgi|in"
    Substitute "s|src=\"/graph_if.svg|src=\"/local/gw/graph_if.svg|in"
  </Location>

  RewriteEngine On
  RewriteCond %{REQUEST_URI} $proxypath$
  RewriteRule ^(.*)$ https://$domain$proxypath/ [R,L]
</Macro>