All Collections
Developing with Shifter
Accessing Shifter Static site on the subdirectory through a reverse proxy on own server
Accessing Shifter Static site on the subdirectory through a reverse proxy on own server
Tomohyco Tsunoda avatar
Written by Tomohyco Tsunoda
Updated over a week ago

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;
}
}

Did this answer your question?