I have a URL, http://example.com
, that I would like to use to serve content from my GitHub Pages site at https://myusername.github.io/mysite/
via a reverse proxy in Apache. This is both as a temporary workaround until I update example.com
‘s DNS setting to point to GitHub Pages, as well as to teach myself how reverse proxies work.
I have my Apache config like so:
<VirtualHost *:80>
ServerName example.com
SSLEngine On
SSLProxyEngine On
SSLProxyVerify none
SSLProxyCheckPeerCN off
ProxyPass "/" "https://myusername.github.io/mysite/"
</VirtualHost>
When I try to go to “example.com”, I get “The proxy server could not handle the request GET /.
Reason: Error during SSL Handshake with remote server.”
Is what I’m trying to do possible, and if so, what should I be changing?
I’m using Apache 2.2.
3
Answers
You should probably remove the line:
SSLEngine On
It enables HTTPS on your port 80… but you don’t provide an SSL certificate (…and HTTPS uses port 443).
You should also add the line:
ProxyPassReverse "/" "https://myusername.github.io/mysite/"
The following config works perfectly on reverse proxy github pages
Make sure you replace myusername with your github username, mysite with your github repo name and custom-domain with your custom url
You don’t have to implement a reverse proxy yourself, since Github allows you to specify a custom domain
https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-
pages-site