1

At the moment we're running our Play app on port 9000 with Apache as a front-end HTTP server like so:

<VirtualHost *:80>
    ServerName vms.gltd.net

    ProxyPass /http-bind http://vms.gltd.net:5280/http-bind/
    ProxyPassReverse /http-bind http://vms.gltd.net:5280/http-bind/

    ProxyPass / http://vms.gltd.net:9000/
    ProxyPassReverse / http://vms.gltd.net:9000/
</VirtualHost>

However when a user signs up Play Authenticate uses the port from play.mvc.Http.Request which is 9000 not 80.

Is there a way to override the port Play Authenticate uses or do we have to move our Play app to its own server and run it on port 80?

thanks,

-Leon

Leon Roy
  • 580
  • 1
  • 5
  • 16

1 Answers1

0

Try this, from the Play documentation:

Advanced proxy settings

When using an HTTP frontal server, request addresses are seen as coming from the HTTP server. In a usual set-up, where you both have the Play app and the proxy running on the same machine, the Play app will see the requests coming from 127.0.0.1.

Proxy servers can add a specific header to the request to tell the proxied application where the request came from. Most web servers will add an X-Forwarded-For header with the remote client IP address as first argument. If the proxy server is running on localhost and connecting from 127.0.0.1, Play will trust its X-Forwarded-For header. If you are running a reverse proxy on a different machine, you can set the trustxforwarded configuration item to true in the application configuration file, like so:

trustxforwarded=true 

However, the host header is untouched, it’ll remain issued by the proxy. If you use Apache 2.x, you can add a directive like:

ProxyPreserveHost on 

The host: header will be the original host request header issued by the client. By combining theses two techniques, your app will appear to be directly exposed.

If you don’t want this play app to occupy the whole root, add an exclusion directive to the proxy config:

ProxyPass /excluded !
Sietse
  • 7,884
  • 12
  • 51
  • 65