Skip to content
This repository has been archived by the owner on Apr 3, 2024. It is now read-only.

octahedroid/hacky-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 

Repository files navigation

PoC proxying to GCP Buckets from Pantheon

Description

This library sets up a proxy for all routes on the site and forward routes to a domain where the static site is deployed.

The only routes that are allowed are ones that are configured via the library i.e. those containing 'php', '/wp/', and 'wp-admin.php',

You can set a different array of URLs using the setSkipUrls method, or add more using the addSkipUrls method.

Usage

When using composer

Add a new file named proxy-loader.php on your composer root project containing the following PHP code.

<?php

// Create new PantheonToGCPBucket instance
$hackyproxy = new \Stevector\HackyProxy\PantheonToGCPBucket();

// Using a single forward configuration
$hackyproxy
  ->setSite('pantheon-proxy-wordpress') // pantheon site
  ->setEnvironment('dev') // pantheon environment
  ->setFramework('wordpress') // pantheon framework `wordpress` or `drupal`
  ->setForwards(
    [
      [
        'path' => '/',
        'url' => 'http://{site}.static.artifactor.io',
        'prefix' => '{site}--{environment}',
      ]
    ]
  )
  ->forward();

// Using a more complex forward configuration
$hackyproxy
  ->setSite('pantheon-rogers-funny-words') // pantheon site
  ->setEnvironment('dev') // pantheon environment
  ->setFramework('wordpress') // pantheon framework
  ->setHash('b54df3e') // pantheon hash
  ->setHashEnabled(true) // pantheon hash-flag
  ->setCacheDisabled(true) // cache-control
  ->setForwards(
    [
      [
        'path' => '/static/',
        'url' => 'http://{site}.static.artifactor.io',
        'prefix' => '{site}--{environment}',
      ],
      [
        'path' => '/',
        'url' => 'https://us-central1-webops-prototypes.cloudfunctions.net',
        'prefix' => '{site}--{environment}',
      ],
    ]
  )
  ->forward();

Add on the autotload section of your composer.json file the following configuration.

"files": [
  "proxy-loader.php"
]

About

PoC proxying to GCP Buckets from Pantheon

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages