Here is an updated example web.xml config using a different proxy target, because the old site didn't work as well as it did before.
The purpose is serving your remote backend from your local dev environment, using Sencha Cmd.
In the workspace root directory, create a file WEB-INF/web.xml with content similar to this example:
(if you don't know where the workspace root is located, try running sencha framework list)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
metadata-complete="true"
version="2.5"
>
<!-- ================================================================= -->
<!-- Reverse HTTP Proxy for the Sencha Cmd web server, e.g. -->
<!-- http://localhost:1841/backend/1 will reflect -->
<!-- http://jsonplaceholder.typicode.com/users/1 -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
<servlet>
<servlet-name>transparentReverseProxy</servlet-name>
<servlet-class>org.eclipse.jetty.servlets.ProxyServlet$Transparent</servlet-class>
<init-param>
<param-name>ProxyTo</param-name>
<param-value>http://jsonplaceholder.typicode.com/users</param-value>
</init-param>
<init-param>
<param-name>HostHeader</param-name>
<param-value>jsonplaceholder.typicode.com</param-value>
</init-param>
<init-param>
<param-name>Prefix</param-name>
<param-value>/backend</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>transparentReverseProxy</servlet-name>
<url-pattern>/backend/*</url-pattern>
</servlet-mapping>
</web-app>
Run from the workspace root directory: sencha web start --j2ee
Now, open in your browser: http://jsonplaceholder.typicode.com/users/1 and http://localhost:1841/backend/1
If the reverse HTTP proxy server is working then both links will give the same JSON output with the latter being served from your local Sencha CMD web server.
Normal request (http://jsonplaceholder.typicode.com/users/1):
Screen Shot 2018-04-20 at 19.15.14.png
Proxied request (http://localhost:1841/backend/1):
Screen Shot 2018-04-20 at 19.15.21.png
This should work with Sencha Cmd v6.1.0 and up, using sencha web start --j2ee, or sencha app watch --fashion --j2ee, etc.
For verbose debug output, run sencha -debug web start --j2ee and look for this line:
Code:
[DBG] 1678819309 proxy /backend/1-->http://jsonplaceholder.typicode.com/users/1