Accessing Shifter Static site on the subdirectory through a reverse proxy on own server

Goal

Make visitors access to the contents in the subdirectory on the Shifter website through the external server (e.g. EC2) with the domain name (e.g. example.com).

Forwarding access to

Structure

Requirements

  • URL of Shifter site (e.g. abc123.on.getshifter.io)

  • Subdirectory Setting is enabled on Shifter

  • Nginx for reverse proxy

Shifter Configurations

Copy Shifter Static site’s URL

It is available on Live page

Make sure Subdirectory Setting is enabled

If not check out the support document: Subdirectory Deploy

Sample configuration (nginx ver. 1.17.10)

Make sure forwarding correct Host header using proxy_set_header

resolver 8.8.8.8 valid=10s ipv6=off;
server {

[...cropped...]


location ~ /subdir/ {
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_redirect off;
set $cloudfront_distribution YOUR-SHIFTER_URL.ON.GETSHIFTER.IO;
proxy_pass https://$cloudfront_distribution;
proxy_ssl_name $cloudfront_distribution;
proxy_ssl_server_name on;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $cloudfront_distribution;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Host $http_host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

Take the Next Step

Get started on your website today with Shifter. Try out our free plan and take the first step towards building the perfect website for you and your visitors.

Copyright © 2023 DigitalCube

A product by

Check out our other products