Skip to content

Instantly share code, notes, and snippets.

@bng44270
Created April 10, 2020 12:48
Show Gist options
  • Save bng44270/98b36265b7fa143565ae2fe8a61e58c3 to your computer and use it in GitHub Desktop.
Save bng44270/98b36265b7fa143565ae2fe8a61e58c3 to your computer and use it in GitHub Desktop.
Reverse Proxy DD-WRT through Apache
##################################
# 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment