Cannot create correct urls for static resources using playframework when using Apache as a proxy

I use Apache server as a proxy for my playframework application. The proxy configuration file is as follows:

> <VirtualHost *:80>
>     ProxyPreserveHost Off
>     ServerAdmin redhorse@viform.net
>     DocumentRoot "/home/admin/www"
>     ServerName viform.net
>     ErrorLog "logs/viform.net-error.log"
>     ProxyPass /zh-cn/ http://localhost:9000/
>     ProxyPassReverse /zh-cn/ http://localhost:9000/  
> </VirtualHost>

When I go to http://viform.net/zh-cn/signin , it shows me the correct page. But the URLs of static resources on the page are incorrect. The generated html page code is as follows:

     ...
    <script type="text/javascript" src="/public/javascripts/base.js">
    </script>
    <script type="text/javascript" src="/public/javascripts/secure/submitbutton.js">
    </script>
    <script type="text/javascript" src="/public/javascripts/secure/signinpanel.js">
    </script>
    ...

The browser cannot find these resources, as their src paths must begin with "/ zh-cn". Can anyone help me figure this out? Thank.

+3
source share
2 answers

Play Group, SO "war.context" Play Framework?, .

GoogleGroups, , . ..

%{ ctx = play.configuration.getProperty('ctx', '') }%

GET     ${ctx}/            Application.index
GET     ${ctx}/hello     Application.hello

app conf.

ctx=zh-cn
+4

play-1.2.2 conf/application.conf,

http.path

:

http.path=/ch-cn

.

+1

All Articles