2

I have isso app running on localhost:63837 and I'd like to proxy requests from https://www.domain.com/isso

These were my approaches:

RewriteRule https://www.domain.com/isso/(.*)$ http://127.0.0.1:63837/$1 [P] 
RewriteRule /isso/(.*)$ http://127.0.0.1:63837/$1 [P] 
RewriteRule /isso(.*)$ http://127.0.0.1:63837/$1 [P]

Normally I'd adjust httpd-vhost.conf but in this case I can't do that on my hoster (uberspace).

<Location "/isso">
  ProxyPass "http://127.0.0.1:63837"
  ProxyPassReverse "http://127.0.0.1:63837"
</Location>

Also, I don't like to use a subdomain for this.

crstin
  • 193
  • 1
  • 2
  • 7
  • `RewriteRule ^isso/(.*)$ http://127.0.0.1:63837/$1 [P]` ? – Dusan Bajic Nov 05 '16 at 21:31
  • @DusanBajic: also 404, unfortunately. But thanks. – crstin Nov 05 '16 at 22:29
  • Just to doublecheck, your hoster will not let you edit .conf but it allows you to launch your app there, on port 63837? – Dusan Bajic Nov 06 '16 at 06:21
  • @DusanBajic: Yeah, it's a special shared hosted centos server which can be accessed via cli with no admin rights. There are some scripts helping users opening ports etc. but no vhost. – crstin Nov 06 '16 at 11:37
  • @DusanBajic: on localhost your solution works perfect. If you'd like you can provide the right answer. – crstin Nov 06 '16 at 19:55

1 Answers1

3

Your second approach was almost correct (in fact, exactly that would work in .conf file).

In per-directory context (Directory or .htaccess), the Pattern is matched against only a partial path: the directory path where the rule is defined is stripped from the path before comparison - up to and including a trailing slash!. The removed prefix always ends with a slash, meaning the matching occurs against a string which never has a leading slash.

Therefore:

RewriteRule ^isso/(.*)$ http://127.0.0.1:63837/$1 [P]
Dusan Bajic
  • 10,249
  • 3
  • 33
  • 43
  • This is perfect and works on my hoster as well now after I got rid of a flaw in my .htaccess. I can't upvote because of my reputation at the moment. +1 – crstin Nov 06 '16 at 21:35