Page 3 of 3 FirstFirst 123
Results 21 to 27 of 27

Thread: "sencha app watch" proxy configuration

  1. #21
    Sencha Premium Member richardvd's Avatar
    Join Date
    Jun 2011
    Location
    NL
    Posts
    255

    Default

    It just forwards the full request AFAIK.

  2. #22
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    123

    Default

    Hmm ... Seems not. I set up reverse proxies inside a local Apache and a local IIS. All is working well. When I use the jetty proxy I'm getting a 500 with no response from jetty itself.

    DBG gives this output. Sadly the WRN-message is empty/null
    PHP Code:
    [DBGexchange @3a73fb1f=GET//example-host:8081/api/customer/list?_dc=1492588105206#CONNECTED(4ms)->SENDING(103ms)sent=103ms on [email protected] example-host:8081 g=HttpGenerator{s=4,h=-1,b=-1,c=-1} p=HttpParser{s=-14,l=0,c=0}[DBG] filled 6144/6144
    [DBG631944685 HTTP/1.1 200 null[DBGFailure on @3a73fb1f=GET//example-host:8081/api/customer/list?_dc=1492588105206#SENDING(105ms)->SENDING(0ms)sent=105ms
    [DBGsetStatus 9 @3a73fb1f=GET//example-host:8081/api/customer/list?_dc=1492588105206#SENDING(1ms)->EXCEPTED(0ms)sent=106ms
    [WRN]
    [
    DBG] finally @3a73fb1f=GET//example-host:8081/api/customer/list?_dc=1492588105206#SENDING(1ms)->EXCEPTED(2ms)sent=108ms on [email protected] example-host:8081 g=HttpGenerator{s=4,h=-1,b=-1,c=-1} p=HttpParser{s=-9,l=0,c=-3} progress=false [email protected]{l(phoenix-dev/196.5.102.132:8081)<->r(/192.168.5.23:50729),d=true,open=true,ishut=false,oshut=false,rb=false,wb=false,w=true,i=1r}-{[email protected] example-host:8081 g=HttpGenerator{s=4,h=-1,b=-1,c=-1} p=HttpParser{s=-9,l=0,c=-3}} 
    Any idea what could be the problem?

  3. #23
    Sencha Premium Member richardvd's Avatar
    Join Date
    Jun 2011
    Location
    NL
    Posts
    255

    Default

    I haven't seen any issues myself with custom headers and cookies going through the Jetty proxyserver.

    You have both a working and non-working situation, so you could use Wireshark to compare the network traffic and find the issue.

  4. #24
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    123

    Default

    Thanks for your answer... Wireshark did not show up any significant differences (except for the order of http-headers). Responses and requests are the same. So I have no idea whats the problem here ...

    Too bad I really would like to switch to the internal jetty. But thats a show-stopper.

  5. #25
    Sencha Premium Member
    Join Date
    Sep 2011
    Posts
    123

    Default

    So I've upgraded to Sencha Cmd 6.5.0.180 and its all working now! Bye, bye IIS

  6. #26
    Sencha Premium User
    Join Date
    May 2016
    Posts
    3

    Default Hi

    Quote Originally Posted by richardvd View Post
    In post #12 above I gave an example configuration file. Put that in WEB-INF/web.xml.

    Run from the workspace root directory: sencha web start --j2ee

    Now, open in your browser: http://example.com/backend/test.php and http://localhost:1841/backend/test.php

    If it's working then both will give the result of the screenshot below:
    Attachment 56044

    For verbose output, run sencha -debug web start --j2ee and look for this line:

    Code:
    [DBG] 785148949 proxy /backend/test.php-->http://example.com/backend/test.php

    Seems great !

    It's almost working for me but......instead of proxying request, I'm simply redirected ton the "example.com/backend" site..

    Any clue ?


    Thx,

    Salva.

  7. #27
    Sencha Premium Member richardvd's Avatar
    Join Date
    Jun 2011
    Location
    NL
    Posts
    255

    Default

    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

Page 3 of 3 FirstFirst 123

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •