server_snippet_nginx.rb 747 B

1234567891011121314151617181920212223242526272829
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. class KnowledgeBase
  3. class ServerSnippetNginx < ServerSnippet
  4. def template_path
  5. <<~ERB
  6. # Add following lines to "server" directive
  7. rewrite ^#{path}(.*)$ /help$1 last;
  8. ERB
  9. end
  10. def template_full
  11. <<~ERB
  12. # Add following lines to "server" directive
  13. if ($host = #{host} ) {
  14. rewrite ^/(api|assets)/(.*)$ /$1/$2 last;
  15. rewrite ^#{path}(.*)$ /help$1 last;
  16. }
  17. ERB
  18. end
  19. def template_original_url
  20. <<~ERB
  21. # Add following line to "Location /" directive, before other proxy_set_header
  22. proxy_set_header X-ORIGINAL-URL $request_uri;
  23. ERB
  24. end
  25. end
  26. end