I have a website hosted on AWS, www.example.com. I have created a blog on Wix myblog.wixsite.com/blog. Now, I want to show the contents of myblog.wixsite.com/blog on www.example.com/blog. So I used the following Nginx conf to try & achieve that.
location /blog/ {
sub_filter 'http://myblog.wixsite.com/' 'https://$http_host/blog/';
sub_filter 'https://myblog.wixsite.com/' 'https://$http_host/blog/';
sub_filter 'href="/posts/' 'href="/blog/';
sub_filter 'href="/category/' 'href="/blog/category/';
sub_filter 'href="/authors/' 'href="/blog/authors/';
sub_filter 'href="/recent/' 'href="/blog/recent/';
proxy_ssl_verify off;
proxy_set_header Host "myblog.wixsite.com";
proxy_set_header X-Forwarded-Host "";
proxy_set_header X-Forwarded-For "";
proxy_set_header Accept-Encoding "";
proxy_set_header Cookie "";
proxy_pass http://myblog.wixsite.com/blog/;
proxy_redirect ~^(http://[^/]+)(/.+)$ https://$http_host$2;
}
Now, when I hit www.example.com/blog, Nginx redirects me to https://myblog.wixsite.com/blog/ instead of showing the content on www.example.com/blog itself. I also tried changing
proxy_pass http://myblog.wixsite.com/blog/;
to
proxy_pass https://myblog.wixsite.com/blog/;
but I started getting the following error.
*532 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: <redacted>, server: www.example.com, request: "GET /blog/ HTTP/2.0", upstream: "https://myblog.wixsite.com/blog/", host: "www.example.com"
I have been at it for a couple of days with no results. Can someone suggest what might I be doing wrong?