0

I have a server running at localhost:3030 and I can access a number of web pages. When I do a wget on localhost:3030/index.html, I obtain the web page. Using a ProxyPassMatch, I was trying to redirect a request on example.com/sparql/<something> to locahost:3030/<something> but it is not working. I am using debian and configuration is as follows:

    <VirtualHost *:80>
    ServerName example.com
   ProxyPass         "/sparql"  "http://localhost:3030/"
   ProxyPassReverse  "/sparql"  "http://localhost:3030/"
   ProxyPassReverseCookieDomain  "localhost"  "example.com"
    ....
    <VirtualHost *:80>

When I am sending a request on example.com/sparql/index.html, the page is returning but none of the images and css files are being returned. Is there a problem with configuration ?

user203788
  • 103
  • 1

1 Answers1

2

Why use ProxyPassMatch for such a simple reverse proxy? You could just...

<VirtualHost *:80>
    ServerName example.com
    ...
    ProxyPass         "/sparql/"  "http://localhost:3030/sparql/"
    ProxyPassReverse  "/sparql/"  "http://localhost:3030/sparql/"
    ProxyPassReverseCookieDomain  "localhost"  "example.com"
</VirtualHost>

Then, if your content is at http://localhost:3030/ there might be some hard coded content that refers to / instead of /sparql/ in the HTML body. While it is possible to also alter the content with mod_substitute, that may lead to other problems. Therefore, it would be recommendable to use a subdomain instead of additional part to the path, like this:

<VirtualHost *:80>
    ServerName sparql.example.com
    ...
    ProxyPass         "/"  "http://localhost:3030/"
    ProxyPassReverse  "/"  "http://localhost:3030/"
    ProxyPassReverseCookieDomain  "localhost"  "sparql.example.com"
</VirtualHost>
Esa Jokinen
  • 46,944
  • 3
  • 83
  • 129
  • actually, i made a mistake when writing the question, my intention is to forward all request from example.com/sparql/ to localhost:3030/ but using your answer and removing the /sparql from localhost:3030 isn't returning any images and css files – user203788 Aug 07 '17 at 12:28
  • I updated my answer to contain solution for both situations. – Esa Jokinen Aug 07 '17 at 13:24
  • thanks, for using a subdomain, it might be a little difficult in my case as i don't have hand on DNS servers – user203788 Aug 07 '17 at 13:33