1

I have web application running on localhost and listening on port 5050. I would like to have this web application under URL with relative path domain.tld/page/app

I tried to use mod_rewrite:

 <Location /page/app> RewriteEngine on RewriteRule .*$ http://127.0.0.1:5050/$1 [P,QSA,NE] </Location> 

This rewrites domain.tld/page/app to domain.tld/login which is not a valid URL on my server.

Is it possible to reverse the rewrite? I can't use ProxyPassReverse because I need to remove relative path from URL when I proxy the request to the application.

2
  • Where is /login coming from? This would seem to be the result of your web application logic, as it doesn't appear to have anything to do with these directives? Commented Aug 5, 2017 at 14:51
  • @MrWhite Yes it is coming from application logic. Application was not written to use relative path. I didn't write this app and I don't want to recompile it. Commented Aug 5, 2017 at 14:54

1 Answer 1

0

This is a textbook case with mod_proxy.

ProxyPass "/page/app/" "http://127.0.0.1:5050/" ProxyPassReverse "/page/app/" "http://127.0.0.1:5050/" 

Notice that with this syntax you don't use this inside a <Location>.

1
  • This changes the URL in browser to domain.tld/login and I get 404 error. The URL should be domain.tld/page/app/login Commented Aug 5, 2017 at 8:40

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.