server_snippet_apache.rb 907 B

12345678910111213141516171819202122232425262728293031
  1. # rubocop:disable Style/FormatStringToken, Lint/MissingCopEnableDirective
  2. class KnowledgeBase
  3. class ServerSnippetApache < ServerSnippet
  4. def template_path
  5. <<-ERB.strip_heredoc
  6. # Add following lines to <VirtualHost> directive
  7. RewriteEngine On
  8. RewriteRule ^#{path}(.*) /help$1 [PT]
  9. ERB
  10. end
  11. def template_full
  12. <<-ERB.strip_heredoc
  13. # Add following lines to <VirtualHost> directive
  14. RewriteEngine On
  15. RewriteCond %{HTTP_HOST} #{host}
  16. RewriteRule (assets|api)/(.*) /$1/$2 [PT]
  17. RewriteCond %{HTTP_HOST} #{host}
  18. RewriteRule #{path}(.*) /help$1 [PT]
  19. ERB
  20. end
  21. def template_original_url
  22. <<-ERB.strip_heredoc
  23. # Add following lines to <VirtualHost> directive, before ProxyPass
  24. SetEnvIf Request_URI "(.*)" ORIGINAL_URL=$1
  25. RequestHeader add X-ORIGINAL-URL %{ORIGINAL_URL}e
  26. ERB
  27. end
  28. end
  29. end