Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created July 30, 2020 01:49
Show Gist options
  • Save joegaudet/3e3bd54814f3a98c0f46a2357d583789 to your computer and use it in GitHub Desktop.
Save joegaudet/3e3bd54814f3a98c0f46a2357d583789 to your computer and use it in GitHub Desktop.
SSLProxyEngine On
AddOutputFilterByType DEFLATE text/html text/plain text/css text/css text/javascript application/javascript
AddOutputFilterByType INFLATE text/xml text/xsl
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
<IfModule dir_module>
DirectoryIndex index.html index.php
</IfModule>
Redirect /wp-admin/install.php https://maintenance.food.ee
RewriteEngine On
##Force SSL on Heroku
# If we receive a forwarded http request from a proxy...
RewriteCond %{HTTP:X-Forwarded-Proto} =http [OR]
# ...or just a plain old http request directly from the client
RewriteCond %{HTTP:X-Forwarded-Proto} =""
RewriteCond %{HTTPS} !=on
# Redirect to https version
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# we don't have stories anymore
RewriteCond %{REQUEST_URI} story
RewriteRule ^(.*)/story/?$ $1 [L,P]
# Redirect to www
RewriteCond %{HTTP_HOST} ^food\.ee
RewriteRule ^(.*)$ https://www.food.ee$1 [R=permanent,L]
# Redirect to help portal
RewriteCond %{HTTP_HOST} ^help\.food\.ee
RewriteRule ^(.*)$ https://foodee.force.com/help/s/$1 [R=permanent,L]
# If we're a bot
RewriteCond %{HTTP_USER_AGENT} prerendertest|googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|Slack-ImgProxy|Slackbot-LinkExpanding|W3C_Validator|SemrushBot [NC]
# Restaurant Index Page
RewriteRule ^/(login|signup|i-forgot-my-password)/?$ https://fancyfox-cdn.food.ee/prerender/$1.html [L,P]
# If we're a bot
RewriteCond %{HTTP_USER_AGENT} prerendertest|googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|Slack-ImgProxy|Slackbot-LinkExpanding|W3C_Validator|SemrushBot [NC]
# Restaurant Index Page
RewriteRule ^/restaurants/(.*)/v3/(.*)/$ https://fancyfox-cdn.food.ee/prerender/restaurants/$1/$2.html [L,P]
# If we're a bot
RewriteCond %{HTTP_USER_AGENT} prerendertest|googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|Slack-ImgProxy|Slackbot-LinkExpanding|W3C_Validator|SemrushBot [NC]
# Restaurant Index Page
RewriteRule ^/restaurants/(.*)/v3/(.*)$ https://fancyfox-cdn.food.ee/prerender/restaurants/$1/$2.html [L,P]
# If we're a bot
RewriteCond %{HTTP_USER_AGENT} prerendertest|googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|Slack-ImgProxy|Slackbot-LinkExpanding|W3C_Validator|SemrushBot [NC]
# Restaurant Index Page
RewriteRule ^/restaurants/(.*)/$ https://fancyfox-cdn.food.ee/prerender/restaurants/$1.html [L,P]
RewriteCond %{HTTP_USER_AGENT} prerendertest|googlebot|bingbot|yandex|baiduspider|facebookexternalhit|twitterbot|rogerbot|linkedinbot|embedly|quora\ link\ preview|showyoubot|outbrain|pinterest|slackbot|vkShare|Slack-ImgProxy|Slackbot-LinkExpanding|W3C_Validator|SemrushBot [NC]
# Menu Pages
RewriteRule ^/restaurants/(.*)$ https://fancyfox-cdn.food.ee/prerender/restaurants/$1.html [L,P]
# Prevent possible click jacking
Header always append X-Frame-Options SAMEORIGIN
# For browser to request HTTPS in all future requests.
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
<Location "/staging/api">
ProxyPass https://api-staging.food.ee/api
ProxyPassReverse https://api-staging.food.ee/api
</Location>
<Location "/staging/sso">
ProxyPass https://api-staging.food.ee/sso
ProxyPassReverse https://api-staging.food.ee/sso
</Location>
<Location "/staging/confirmations">
ProxyPass https://api-staging.food.ee/confirmations
ProxyPassReverse https://api-staging.food.ee/confirmations
</Location>
<Location "/api">
ProxyPass https://api.food.ee/api
ProxyPassReverse https://api.food.ee/api
</Location>
<Location "/sso">
ProxyPass https://api.food.ee/sso
ProxyPassReverse https://api.food.ee/sso
</Location>
<Location "/confirmations">
ProxyPass https://api.food.ee/confirmations
ProxyPassReverse https://api.food.ee/confirmations
</Location>
<Location "/swiftfox-sitemap.xml">
ProxyPass https://api.food.ee/sitemap.xml
ProxyPassReverse https://api.food.ee/sitemap.xml
</Location>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment