is there an Apigee/Edge Proxy to host static HTML pages

Not applicable

Does Apigee Edge provide a proxy that can host static HTML/CSS/JS pages? I know I don't need Edge for that apache httpd, nginx or anything can do it but is there a way to it through edge proxy?

Solved Solved
3 11 5,009
1 ACCEPTED SOLUTION

Not applicable

hi @Gagan Arora,

Please find the sample proxy attached. Deploy it and access http://<host>/sampleproxy/index for a quick demo. Let me know if it helps.

View solution in original post

11 REPLIES 11

Not applicable

You can use a pass through proxy to you server hosting static pages.

Let me know if that was the answer you expected.

but where do I keep the content of the HTML / CSS / JS files? I don't want to setup another server to keep these files. I would like these files to be on Edge RMP servers

Not applicable

Yes, you can. In Edge, there is an option to use node.js as target. So, in that node.js target you can host your HTML content. Let me know if you need a sample proxy.

Is node.js server automatically deployed / installed on RMP servers? Yes a sample proxy would be helpful.

Please share sample proxy @Anshul Agarwal



Not applicable

hi @Gagan Arora,

Please find the sample proxy attached. Deploy it and access http://<host>/sampleproxy/index for a quick demo. Let me know if it helps.

Thank you this worked and helped me learn a thing or two about node-js

Hey there, I'm working on this with Gagan, and had a couple of questions. Does this pattern of zipping the css and js scripts in to the public folder and uploading them work with a more current version of express? Trying to use express 3.4.8, which is what the Apigee website says is used, and having an issue where the page is loading but 404'ing on getting the css and js files. I have my node set up with a * route going to an ejs view. It works fine on a localhost. I can attach the .zip if that would be helpful.

node.js option is straight forward to host static content. An alternative is to use the AssignMessage policy.

Please note that hosting static content is not the best use of EDGE. APIs belong to a different paradigm and static content is a force fit in EDGE. Also, any traffic to the static content will consume the available traffic quota for a paid customer. If the number of such static pages is more than a few, this is better hosted in a different server.

Not applicable

For completeness here is a sample AssignMessage policy that serves up a simple form:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<AssignMessage async="false" continueOnError="true" enabled="true" name="payForm">
    <DisplayName>payForm</DisplayName>
    <Set>
        <Payload contentType="text/html">
            <html xmlns="http://www.w3.org/1999/xhtml">
            <head>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            </head>
            <body id="main_body">
                <h2>Test PaymentMethod</h2>
                <form method="post" action="https://secure.submit.form.foo.com/cgi/foo">
                    <table>
                        <tr>
                            <td>
                                <label for="vin_WebSession_vid">vin_WebSession_vid</label>
                            </td>
                            <td>
                                <input id="vin_WebSession_vid" name="vin_WebSession_vid" type="text" maxlength="255" value="{paymentMethod.webSessionVid}" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="vin_PaymentMethod_accountHolderName">vin_PaymentMethod_accountHolderName</label>
                            </td>
                            <td>
                                <input id="vin_PaymentMethod_accountHolderName" name="vin_PaymentMethod_accountHolderName" type="text" maxlength="255" value="{paymentMethod.accountHolderName}" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <label for="vin_PaymentMethod_customerDescription">vin_PaymentMethod_customerDescription</label>
                            </td>
                            <td>
                                <input id="vin_PaymentMethod_customerDescription" name="vin_PaymentMethod_customerDescription" type="text" maxlength="255" value="{paymentMethod.customerDescription}" />
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input id="saveForm" type="submit" name="submit" value="Submit" />
                            </td>
                        </tr>
                    </table>
                </form>
            </body>
            </html>
        </Payload>
    </Set>
    <IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
    <AssignTo createNew="false" transport="https" type="request" />
</AssignMessage>


This is useful when you want to provide a quick and dirty test driver. Generally we discourage serving this type of content from Edge in production.

adas
Participant V

@Gagan Arora Apigee Edge does provide you the container whereby you can host your nodejs app like any other web app with html and .js files in there. But please be aware of the fact that depending on the scale at which you implement this and what pages you host, your performance might be significantly impacted especially if you have other apis serving traffic on the same org as well as the nodeapp which works like a target webserver.