I have a puma server and an apache server running on the same computer. I am trying to implement a reverse proxy in apache to forward example.mooo.com/redmine to the puma server (listening to localhost:9292)

My .conf file for apache is the following :

<VirtualHost *:443>
    ServerName example.mooo.com
    ServerAlias example.mooo.com

    SSLEngine on
    SSLCertificateFile /etc/apache2/ssl/cert.pem
    SSLCertificateKeyFile /etc/apache2/ssl/cert.key
    <Location "/redmine/">
        ProxyPass "http://localhost:9292"
        ProxyPassReverse "http://localhost:9292/"
        Substitute "s|http://localhost:9292/|https://example.mooo.com/redmine/|i"

With this config the browser can load the first page, but without the styles and all the links are pointing to http://example.mooo.com/xxx instead of http://example.mooo.com/redmine/xxx

  • did you tried without subtitute ? did you tried only RewriteRule /redmine/(.*) http://localhost:9292/$1 [P] instead of all thoose location stuff ? – Froggiz Nov 5 '15 at 22:59
  • It has to be a typo: on ProxyPass there is no trailing slash, while on ProxyPassReverse there is one. – 473183469 Nov 6 '15 at 7:37
  • @473183469 I tried with and without trailing slash at the end of ProxyPass and ProxyPassReverse. No change. – Quentin Nov 6 '15 at 12:08
  • @Froggiz In fact Substitute doesn't change anything. whether it is here or not I have the same behaviour. If I understand correctly, the RewriteRule you propose will perform the redirection (it would alter only incoming requests). The redirection is not the problem here, and it is exactly what apache is advising not to do : httpd.apache.org/docs/current/en/rewrite/avoid.html – Quentin Nov 6 '15 at 12:15
  • it is about testing, anyway did you checked your browser log at least ? – Froggiz Nov 6 '15 at 12:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.