Java - UrlRewriteFilter and AppEngine Flexible

19 views
Skip to first unread message

Massimo Mandaglio

unread,
Nov 14, 2017, 4:44:46 AM11/14/17
to Google App Engine
My webapp manage an ERP with PrimeFaces (JSF) and WebSite with RythmEngine.
To co-existing the engine and app all-in-one (for various reason) i have configured the Rythm with the /www/* servlet and JSF on *.xhtml.
But i need a pretty url and i use UrlRewriteFilter based on a sub-domain:
- www.* for /www/*
- sam/admin.* for ERP (*.xhtml)
- ...

In local test all working correctly, but when i deploy on AppEngine the "server-name" for the condition is an IP and not a domain.
Before the introduction of UrlRewriteFilter the request.getServerName() work correctly with the domain.

You know the alternative solution or why i have this problem?



<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE urlrewrite PUBLIC "-//tuckey.org//DTD UrlRewrite 3.0//EN" "http://tuckey.org/res/dtds/urlrewrite3.0.dtd">
<urlrewrite default-match-type="wildcard">
 
<!-- http://tuckey.org/urlrewrite/manual/3.0 -->
 
<!-- https://devtidbits.com/2011/11/28/tuckey-urlrewrite-how-to/ -->
 
<rule>
 
<from>/**</from>
 
<set name="customer">%{server-name}</set>
 
</rule>
 
<rule>
 
<condition type="server-name" operator="equal">www.*</condition>
 
<from>/**</from>
 
<to last="true">/www/$1</to>
 
</rule>
 
<rule>
 
<condition type="server-name" operator="equal">ws.*</condition>
 
<from>/**</from>
 
<to last="true">/ws$1</to>
 
</rule>
 
<rule>
 
<condition type="server-name" operator="equal" next="or">sam.*</condition>
 
<condition type="server-name" operator="equal">admin.*</condition>
 
<from>/**</from>
 
<to last="true">/$1</to>
 
</rule>
 
<rule>
 
<condition type="server-name" operator="equal">*.*</condition>
 
<from>/**</from>
 
<to last="true">/www/$1</to>
 
</rule>
</urlrewrite>

Reply all
Reply to author
Forward
0 new messages