{"id":17196390,"url":"https://github.com/darold/modproxyperlhtml","last_synced_at":"2025-04-13T20:46:14.885Z","repository":{"id":3715159,"uuid":"4787202","full_name":"darold/modproxyperlhtml","owner":"darold","description":"Apache2::ModProxyPerlHtml is the most advanced Apache output filter to rewrite HTTP headers and HTML links for reverse proxy usage. It is written in Perl and exceeds all mod_proxy_html.c limitations without performance lost. ","archived":false,"fork":false,"pushed_at":"2022-05-05T16:52:33.000Z","size":35,"stargazers_count":6,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-13T20:46:12.834Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://modproxyhtml.darold.net/","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"awesto/django-shop","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/darold.png","metadata":{"files":{"readme":"README","changelog":"ChangeLog","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-06-25T20:47:39.000Z","updated_at":"2023-07-25T13:45:13.000Z","dependencies_parsed_at":"2022-09-14T03:50:28.487Z","dependency_job_id":null,"html_url":"https://github.com/darold/modproxyperlhtml","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darold%2Fmodproxyperlhtml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darold%2Fmodproxyperlhtml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darold%2Fmodproxyperlhtml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darold%2Fmodproxyperlhtml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darold","download_url":"https://codeload.github.com/darold/modproxyperlhtml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248782275,"owners_count":21160716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-15T01:53:05.793Z","updated_at":"2025-04-13T20:46:14.867Z","avatar_url":"https://github.com/darold.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"NAME\n    Apache2::ModProxyPerlHtml - rewrite HTTP headers and HTML links for\n    reverse proxy usage\n\nDESCRIPTION\n    Apache2::ModProxyPerlHtml is the most advanced Apache output filter to\n    rewrite HTTP headers and HTML links for reverse proxy usage. It is\n    written in Perl and exceeds all mod_proxy_html.c limitations without\n    performance lost.\n\n    Apache2::ModProxyPerlHtml is very simple and has far better\n    parsing/replacement of URL than the original C code. It also supports\n    meta tag, CSS, and javascript URL rewriting and can be used with\n    compressed HTTP. You can now replace any code by other, like changing\n    image names or anything else. mod_proxy_html can't do all of that. Since\n    release 3.x ModProxyPerlHtml is also able to rewrite HTTP headers with\n    Refresh url redirection and Referer.\n\n    The replacement capability concern only the following HTTP content type:\n\n            text/javascript\n            text/html\n            text/css\n            text/xml\n            application/.*javascript\n            application/.*xml\n\n    other kind of file, will be left untouched (or see ProxyHTMLContentType\n    and ProxyHTMLExcludeContentType).\n\nAVAILIBILITY\n    You can get the latest version of Apache2::ModProxyPerlHtml from CPAN\n    (http://search.cpan.org/).\n\nPREREQUISITES\n    You must have Apache2, mod_proxy, mod_perl and IO::Compress::Zlib perl\n    modules installed on your system.\n\n  Installation on RH/CentOs\n    Install Apache2, apxs, the Epel repository (for mod_perl install) and\n    the Perl Module IO::Compress:\n\n            yum install httpd httpd-devel\n            yum install epel-release\n            yum install perl-IO-Compress\n\n    Install ModPerl, minimal version to work with Apache 2.4 is 2.0.10:\n\n            yum list | grep mod_perl\n            yum --enablerepo=epel -y install mod_perl mod_perl-devel\n\n    Enable mod_perl:\n\n            a2enconf mod_perl\n            systemctl reload apache2\n\n    The Apache module mod_ssl is not available by default, install it:\n\n            yum install mod_ssl\n\n    If the firewall is enabled you might want to allow access to the Apache\n    services\n\n            firewall-cmd --permanent --add-service=http\n            firewall-cmd --permanent --add-service=https\n            firewall-cmd --reload\n\n  Installation on Debian/Ubuntu\n    To have Apache2 server and apxs command:\n\n            apt install apache2 apache2-dev\n\n    ModPerl can be installed using:\n\n            apt install libapache2-mod-perl2 libapache2-mod-perl2-dev\n\n    ModProxyPerlHtml need additional Perl module IO::Compress:\n\n            apt install libio-compress-perl\n\n    Enable mod_proxy:\n\n            a2enmod proxy\n            a2enmod proxy_http\n            a2enmod proxy_ftp\n            a2enmod proxy_connect\n\n    Enable the configuration and mod_perl:\n\n            a2enmod perl\n\nINSTALLATION\n            % perl Makefile.PL\n            % make \u0026\u0026 make install\n\nAPACHE CONFIGURATION\n    On Debian/Ubuntu set the following configuration into the VirtualHost\n    section of files /etc/apache2/sites-available/default-ssl.conf and\n    /etc/apache2/sites-available/000-default.conf. On CentOS/RedHat add it\n    to /etc/httpd/conf.d/vhost.conf.\n\n        ProxyRequests Off\n        ProxyPreserveHost Off\n        ProxyPass       /webcal/  http://webcal.domain.com/\n\n        PerlInputFilterHandler Apache2::ModProxyPerlHtml\n        PerlOutputFilterHandler Apache2::ModProxyPerlHtml\n        SetHandler perl-script\n        # Use line below and comment line above if you experience error:\n        # \"Attempt to serve directory\". The reason is that with SetHandler\n        # DirectoryIndex is not working \n        # AddHandler perl-script *\n        PerlSetVar ProxyHTMLVerbose \"On\"\n        LogLevel Info\n\n\n        \u003cLocation /webcal/\u003e\n            ProxyPassReverse /\n            PerlAddVar ProxyHTMLURLMap \"/ /webcal/\"\n            PerlAddVar ProxyHTMLURLMap \"http://webcal.domain.com /webcal\"\n        \u003c/Location\u003e\n\n    Note that here FilterHandlers are set globally, you can also set them in\n    any \u003cLocation\u003e part to set it locally and avoid calling this Apache\n    module globally.\n\n    If you want to rewrite some code on the fly, like changing images\n    filename you can use the perl variable ProxyHTMLRewrite under the\n    location directive as follow:\n\n        \u003cLocation /webcal/\u003e\n            ...\n            PerlAddVar ProxyHTMLRewrite \"/logo/image1.png /images/logo1.png\"\n            # Or more complicated to handle space in the code as space is the\n            # pattern / substitution separator character internally in ModProxyPerlHtml\n            PerlAddVar ProxyHTMLRewrite \"ajaxurl[\\s\\t]*=[\\s\\t]*'/blog' ajaxurl = '/www2.mydom.org/blog'\"\n            ...\n        \u003c/Location\u003e\n\n    this will replace each occurence of '/logo/image1.png' by\n    '/images/logo1.png' in the entire stream (html, javascript or css). Note\n    that this kind of substitution is done after all other proxy related\n    replacements.\n\n    In some conditions javascript code can be replaced by error, for\n    example:\n\n            imgUp.src = '/images/' + varPath + '/' + 'up.png';\n\n    will be rewritten like this:\n\n            imgUp.src = '/URL/images/' + varPath + '/URL/' + 'up.png';\n\n    To avoid the second replacement, write your JS code like that:\n\n            imgUp.src = '/images/' + varPath + unescape('%2F') + 'up.png';\n\n    ModProxyPerlHTML replacement is activated on certain HTTP Content Type.\n    If you experienced that replacement is not activated for your file type,\n    you can use the ProxyHTMLContentType configuration directive to\n    redefined the HTTP Content Type that should be parsed by\n    ModProxyPerlHTML. The default value is the following Perl regular\n    expresssion:\n\n            PerlAddVar ProxyHTMLContentType    (text\\/javascript|text\\/html|text\\/css|text\\/xml|application\\/.*javascript|application\\/.*xml)\n\n    If you know exactly what you are doing by editing this regexp fill free\n    to add the missing Content-Type that must be parsed by ModProxyPerlHTML.\n    Otherwise drop me a line with the content type, I will give you the\n    rigth expression. If you don't know about the content type, with FireFox\n    simply type Ctrl+i on the web page.\n\n    Some MS Office files may conflict with the above ProxyHTMLContentType\n    regex like .docx or .xlsx files. The result is that there could suffer\n    of replacement inside and the file will be corrupted. to prevent this\n    you have the ProxyHTMLExcludeContentType configuration directive to\n    exclude certain content-type. Here is the default value:\n\n            PerlAddVar ProxyHTMLExcludeContentType  (application\\/vnd\\.openxml)\n\n    If you have problem with other content-type, use this directive. For\n    example, as follow:\n\n            PerlAddVar ProxyHTMLExcludeContentType  (application\\/vnd\\.openxml|application\\/vnd\\..*text)\n\n    this regex will prevent any MS Office XML or text document to be parsed.\n\n    Some javascript libraries like JQuery are wrongly rewritten by\n    ModProxyPerlHtml. The problem is that those javascript code include some\n    code and regex that are detected as links and rewritten. The only way to\n    fix that is to exclude those files from the URL rewritter by using the\n    \"ProxyHTMLExcludeUri\" configuration directive. For example:\n\n            PerlAddVar ProxyHTMLExcludeUri  jquery.min.js$\n            PerlAddVar ProxyHTMLExcludeUri  ^.*\\/jquery-lib\\/.*$\n\n    Any downloaded URI that contains the given regex will be returned asis\n    without rewritting. You can use this directive multiple time like above\n    to match different cases.\n\nLIVE EXAMPLE\n    Here is the reverse proxy configuration I use to give access to Internet\n    users to internal applications:\n\n        ProxyRequests Off\n        ProxyPreserveHost Off\n        ProxyPass       /webmail/  http://webmail.domain.com/\n        ProxyPass       /webcal/  http://webcal.domain.com/\n        ProxyPass       /intranet/  http://intranet.domain.com/\n\n\n        PerlInputFilterHandler Apache2::ModProxyPerlHtml\n        PerlOutputFilterHandler Apache2::ModProxyPerlHtml\n        SetHandler perl-script\n        # Use line below iand comment line above if you experience error:\n        # \"Attempt to serve directory\". The reason is that with SetHandler\n        # DirectoryIndex is not working \n        # AddHandler perl-script *\n        PerlSetVar ProxyHTMLVerbose \"On\"\n        LogLevel Info\n\n\n        # URL rewriting\n        RewriteEngine   On\n        #RewriteLog      \"/var/log/apache/rewrite.log\"\n        #RewriteLogLevel 9\n        # Add ending '/' if not provided\n        RewriteCond     %{REQUEST_URI}  ^/mail$\n        RewriteRule     ^/(.*)$ /$1/    [R]\n        RewriteCond     %{REQUEST_URI}  ^/planet$\n        RewriteRule     ^/(.*)$ /$1/    [R]\n        # Add full path to the CGI to bypass the index.html redirect that may fail\n        RewriteCond     %{REQUEST_URI}  ^/calendar/$\n        RewriteRule     ^/(.*)/$ /$1/cgi-bin/wcal.pl    [R]\n        RewriteCond     %{REQUEST_URI}  ^/calendar$\n        RewriteRule     ^/(.*)$ /$1/cgi-bin/wcal.pl     [R]\n\n\n        \u003cLocation /webmail/\u003e\n            ProxyPassReverse /\n            PerlAddVar ProxyHTMLURLMap \"/ /webmail/\"\n            PerlAddVar ProxyHTMLURLMap \"http://webmail.domain.com /webmail\"\n            # Use this to disable compressed HTTP\n            #RequestHeader   unset   Accept-Encoding\n        \u003c/Location\u003e\n\n\n        \u003cLocation /webcal/\u003e\n            ProxyPassReverse /\n            PerlAddVar ProxyHTMLURLMap \"/ /webcal/\"\n            PerlAddVar ProxyHTMLURLMap \"http://webcal.domain.com /webcal\"\n        \u003c/Location\u003e\n\n\n        \u003cLocation /intranet/\u003e\n            ProxyPassReverse /\n            PerlAddVar ProxyHTMLURLMap \"/ /intranet/\"\n            PerlAddVar ProxyHTMLURLMap \"http://intranet.domain.com /intranet\"\n            # Rewrite links that give access to the two previous location \n            PerlAddVar ProxyHTMLURLMap \"/intranet/webmail /webmail\"\n            PerlAddVar ProxyHTMLURLMap \"/intranet/webcal /webcal\"\n        \u003c/Location\u003e\n\n    This gives access two a webmail and webcal application hosted internally\n    to all authentified users through their own Internet acces. There's also\n    one acces to an Intranet portal that have links to the webcal and\n    webmail application. Those links must be rewritten twice to works.\n\nROT13 obfuscation\n    Some links can be obfucated to be hidden from google or other robots. To\n    enable encode/decode of those links you can use the ProxyHTMLRot13Links\n    directive as follow:\n\n            PerlAddVar ProxyHTMLRot13Links All\n\n    All links in the page will be decoded before being rewritten and\n    re-encoded.\n\n    If obfuscation occurs on some attributs only you can set the value as a\n    pair of element:attribut where the decoding/encoding must be applied.\n    For example:\n\n            PerlAddVar ProxyHTMLRot13Links a:data-href\n            PerlAddVar ProxyHTMLRot13Links a:href\n\nBUGS\n    Apache2::ModProxyPerlHtml is still under development and is pretty\n    stable. Please send me email to submit bug reports or feature requests.\n\nCOPYRIGHT\n    Copyright (c) 2005-2022 - Gilles Darold\n\n    All rights reserved. This program is free software; you may redistribute\n    it and/or modify it under the same terms as Perl itself.\n\nAUTHOR\n    Created and maintained by :\n\n            Gilles Darold\n            \u003cgilles at darold dot net\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarold%2Fmodproxyperlhtml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarold%2Fmodproxyperlhtml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarold%2Fmodproxyperlhtml/lists"}