CloudronManifest: Configurable Environment Variable?



  • How can we add a configurable environment variable to the CloudronManifest.json? Similar to the ones already present for TCP Ports, but to allow arbitrary values.

    My use case is: I'd love to create a proxy app which forwards all traffic to another Cloudron app to provide a beautiful, front facing url to the end customer.

    Let's say I have installed Mautic atmarketing.domain.tld and I create a custom landing page within the Mautic app. This will be reachable viamarketing.domain.tld/my-landing-page. Now I'd love to install a proxy app which runs onmy-landing-page.com and proxies all requests to a configurable url (in this case tomarketing.domain.tld/my-landing-page.

    It would be awesome to be able to configure the proxy url from the app configuration ui and pass it's value as environment variable.



  • I'd love to see this feature too! Sadly, there is no way to do such a thing yet.

    Two possible workarounds for your problem:

    • Create a basic admin interface under/admin or something, that would allow you to configure your proxy
    • Assume that someone who configures a proxy is at ease with a command line, and just have a config file under/app/data that the user can configure with the webterminal


  • I created an initial package which allows a create a apache2.conf:
    https://git.cloudron.io/mandelkind/proxy-app

    Now I've installed it atproxy.domain.tld and configured it as follows:

    <VirtualHost *:80>
        ProxyPreserveHost On
        SSLProxyEngine on
    
        # Servers to proxy the connection, or;
        # List of application servers:
        # Usage:
        # ProxyPass / http://[IP Addr.]:[port]/
        # ProxyPassReverse / http://[IP Addr.]:[port]/
        # Example: 
        ProxyPass / https://marketing.domain.tld/testseite/
        ProxyPassReverse / https://marketing.domain.tld/testseite/
    </VirtualHost>
    

    If I now start the app and try to openhttps://proxy.domain.tld in the browser, it just loads for an infinite amount of time - seems like there is some sort of infinite loop somewhere.

    Does anybody know whats wrong with my setup?



  • This is what I get as console output, after letting it run for a looooong time:

    14:53:10 [main] [Mon May 14 12:53:10.366258 2018] [core:notice] [pid 1] AH00094: Command line: '/usr/sbin/apache2 -D FOREGROUND'
    
    
    
    
    14:53:27 [main] [Mon May 14 12:53:27.312102 2018] [mpm_prefork:error] [pid 1] AH00161: server reached MaxRequestWorkers setting, consider raising the MaxRequestWorkers setting
    14:58:16 [main] [Mon May 14 12:58:16.990018 2018] [proxy_http:error] [pid 10] (70007)The timeout specified has expired: [client 172.18.0.1:56316] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:16 [main] [Mon May 14 12:58:16.991921 2018] [proxy:error] [pid 10] [client 172.18.0.1:56316] AH00898: Error reading from remote server returned by /
    14:58:17 [main] [Mon May 14 12:58:17.019803 2018] [proxy_http:error] [pid 11] (70007)The timeout specified has expired: [client 172.18.0.1:56338] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:17 [main] [Mon May 14 12:58:17.025742 2018] [proxy:error] [pid 11] [client 172.18.0.1:56338] AH00898: Error reading from remote server returned by /testseite/
    14:58:17 [main] [Mon May 14 12:58:17.034610 2018] [proxy_http:error] [pid 12] (70007)The timeout specified has expired: [client 172.18.0.1:56348] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:17 [main] [Mon May 14 12:58:17.036525 2018] [proxy:error] [pid 12] [client 172.18.0.1:56348] AH00898: Error reading from remote server returned by /testseite/testseite/
    14:58:17 [main] [Mon May 14 12:58:17.048372 2018] [proxy_http:error] [pid 13] (70007)The timeout specified has expired: [client 172.18.0.1:56356] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:17 [main] [Mon May 14 12:58:17.049827 2018] [proxy:error] [pid 13] [client 172.18.0.1:56356] AH00898: Error reading from remote server returned by /testseite/testseite/testseite/
    14:58:17 [main] [Mon May 14 12:58:17.063919 2018] [proxy_http:error] [pid 14] (70007)The timeout specified has expired: [client 172.18.0.1:56362] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:17 [main] [Mon May 14 12:58:17.065509 2018] [proxy:error] [pid 14] [client 172.18.0.1:56362] AH00898: Error reading from remote server returned by /testseite/testseite/testseite/testseite/
    14:58:17 [main] [Mon May 14 12:58:17.510359 2018] [proxy_http:error] [pid 15] (70007)The timeout specified has expired: [client 172.18.0.1:56368] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:17 [main] [Mon May 14 12:58:17.511644 2018] [proxy:error] [pid 15] [client 172.18.0.1:56368] AH00898: Error reading from remote server returned by /testseite/testseite/testseite/testseite/testseite/
    14:58:18 [main] [Mon May 14 12:58:18.527941 2018] [proxy_http:error] [pid 16] (70007)The timeout specified has expired: [client 172.18.0.1:56378] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:18 [main] [Mon May 14 12:58:18.529377 2018] [proxy_http:error] [pid 17] (70007)The timeout specified has expired: [client 172.18.0.1:56384] AH01102: error reading status line from remote server marketing.domain.tld:443
    14:58:18 [main] [Mon May 14 12:58:18.529762 2018] [proxy:error] [pid 16] [client 172.18.0.1:56378] AH00898: Error reading from remote server returned by /testseite/testseite/testseite/testseite/testseite/testseite/
    


  • Are you able to curl the mautic URL from your proxy app?



  • @girish thanks for getting back on this. Had to playing around with the apache2 configuration and was finally able to figure out a way that works. To make a long story short:ProxyPreserveHost lead to a infinite loop. As soon as I removed it, things started working.

    I've put together the final app here, maybe this is of use for someone else:
    https://git.cloudron.io/mandelkind/proxy-app

    Given the fact that I had to play around quite a bit, maybe we should add this to the app store as well? As a helper app, like the LAMP one.