I’m trying to setup a simple proxy in Apache for RESTful services that I have on a different server. For example, if I go to https://myclient.com/services/hello it will show me the JSON for the URL https://myserver.com/services/hello.
I’m doing this to get cross-domain ajax working. I’ve found a lot of information about how to set this up, but none of the suggestions I have found work. I thought this should be fairly straightforward, so it’s probably an easy answer for someone.
My current settings are forwarding me to the RESTful URL instead of just showing the content. I’m using a basic Apache setup without virtual hosts and configuring everything in my httpd.conf. I am using SSL and also am using a proxy to Tomcat on the same Apache server:
SSLProxyEngine On
RewriteEngine On
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{SERVER_NAME}/$1 [L,R]
ProxyPass /services/ https://myserver.com/services/
ProxyPassReverse /services/ https://myserver.com/services/
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
I’ve tried a combination of a lot of other settings as well, including an addition RewriteRule, but this simple configuration is the closest I’ve gotten.
The problems were due to a SSO server that I had setup – requests were being redirected through this server, and this caused a redirect from the SSO server to the API server. The apache settings were correct.