Jump to content

Setting ExtRoot to a cdn URL


Mehmet Emin

Recommended Posts

OK, browser will cache those static files after first fetch.

But the first fetch speed is so important to user experience so please allow ExtRoot and other properties for setting static served files to be set like this.

ExtRoot := 'http://cdn.aaaaaaaaa.com/'

We need to have minimum impact on the web app server. It should serve the dynamic content.

All static resources better served by a cdn.

Thanks

  • Like 4
Link to comment
Share on other sites

On 5/29/2020 at 12:26 PM, Mehmet Emin said:

OK, browser will cache those static files after first fetch.

But the first fetch speed is so important to user experience so please allow ExtRoot and other properties for setting static served files to be set like this.

ExtRoot := 'http://cdn.aaaaaaaaa.com/'

We need to have minimum impact on the web app server. It should serve the dynamic content.

All static resources better served by a cdn.

Thanks

I had asked/have requested this a long time ago. It would really be good to have.

  • Like 2
  • Upvote 1
Link to comment
Share on other sites

  • 4 months later...

@Farshad,

The idea is excellent !!!

• On an intranet, where users open recurrently an unigui application from a Browser, opening is fast.

• But from an extranet (web), user will wait...wait....wait, and giving up, believing that the portal web does not work.

This situation already happened for my customer who decided,  for confidentiality reasons, to put a locally server with a low ADSL (no vps).

Please, can you think seriously to this solution (cdn).

Best regards.

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

+1

Hi @Farshad Mohajeri,  We are going to renew soon and this issue of the CDN interests us that it is available, are there future plans for this implementation?
We use several IIS instances for the hyperserver to support concurrency, yet being able to improve ExtJS download is vital on slow connections
Thank you

  • Like 1
Link to comment
Share on other sites

  • 5 months later...

I have managed to DO it using IIS and url rewrite module / outbound rules.

All my ext and unigui related stuff is served by a CDN now.

I do not know why uniGUI does not add this feature internally but never mind it is possible with rewrite.

  • Like 1
Link to comment
Share on other sites

On 5/22/2021 at 7:42 PM, Mehmet Emin said:

I have managed to DO it using IIS and url rewrite module / outbound rules.

All my ext and unigui related stuff is served by a CDN now.

I do not know why uniGUI does not add this feature internally but never mind it is possible with rewrite.

Hello Mehmet,

Great !

Could you please show us how can you did it  (Step by Step) ?

Thx.

 

Link to comment
Share on other sites

Hi @Abaksoft

I used IIS 10. Install urlrewrite2.exe module for IIS from this url: https://www.iis.net/downloads/microsoft/url-rewrite

Using url rewrite module goto manage server varibles and add two variables: HTTP_X_ORIGINAL_ACCEPT_ENCODING and HTTP_ACCEPT_ENCODING

The following web.config file will do the rest. Please configure this config as per your case.

** I am using mobiletoolkit so there is "/m" in uniGUI urls.

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="RewriteUserFriendlyURL1" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="myapp/myisapi.dll/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules rewriteBeforeCache="true">
            
                <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
                    <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
                        <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
                </rule>
                <preConditions>
                    <preCondition name="NeedsRestoringAcceptEncoding">
                    <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
                    </preCondition>
                </preConditions>            
                        
                <rule name="ext-7.0.0" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/ext-7.0.0/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/ext-7.0.0/{R:1}" />
                </rule>
                
                <rule name="uni-1.90.0.1549" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/uni-1.90.0.1549/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/uni-1.90.0.1549/{R:1}" />
                </rule>

                <rule name="unim-1.90.0.1549" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/unim-1.90.0.1549/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/unim-1.90.0.1549/{R:1}" />
                </rule>

                <rule name="unipackages-7.0.0" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/unipackages-7.0.0/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/unipackages-7.0.0/{R:1}" />
                </rule>
                
            </outboundRules>
        </rewrite>
        <urlCompression doStaticCompression="true" />
    </system.webServer>
</configuration>
 

 

 

 

  • Like 2
  • Upvote 1
Link to comment
Share on other sites

16 hours ago, Mehmet Emin said:

Hi @Abaksoft

I used IIS 10. Install urlrewrite2.exe module for IIS from this url: https://www.iis.net/downloads/microsoft/url-rewrite

Using url rewrite module goto manage server varibles and add two variables: HTTP_X_ORIGINAL_ACCEPT_ENCODING and HTTP_ACCEPT_ENCODING

The following web.config file will do the rest. Please configure this config as per your case.

** I am using mobiletoolkit so there is "/m" in uniGUI urls.

web.config:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="RewriteUserFriendlyURL1" enabled="true" patternSyntax="Wildcard" stopProcessing="true">
                    <match url="*" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="myapp/myisapi.dll/{R:1}" />
                    <serverVariables>
                        <set name="HTTP_X_ORIGINAL_ACCEPT_ENCODING" value="{HTTP_ACCEPT_ENCODING}" />
                        <set name="HTTP_ACCEPT_ENCODING" value="" />
                    </serverVariables>
                </rule>
            </rules>
            <outboundRules rewriteBeforeCache="true">
            
                <rule name="RestoreAcceptEncoding" preCondition="NeedsRestoringAcceptEncoding">
                    <match serverVariable="HTTP_ACCEPT_ENCODING" pattern="^(.*)" />
                        <action type="Rewrite" value="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" />
                </rule>
                <preConditions>
                    <preCondition name="NeedsRestoringAcceptEncoding">
                    <add input="{HTTP_X_ORIGINAL_ACCEPT_ENCODING}" pattern=".+" />
                    </preCondition>
                </preConditions>            
                        
                <rule name="ext-7.0.0" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/ext-7.0.0/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/ext-7.0.0/{R:1}" />
                </rule>
                
                <rule name="uni-1.90.0.1549" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/uni-1.90.0.1549/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/uni-1.90.0.1549/{R:1}" />
                </rule>

                <rule name="unim-1.90.0.1549" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/unim-1.90.0.1549/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/unim-1.90.0.1549/{R:1}" />
                </rule>

                <rule name="unipackages-7.0.0" preCondition="NeedsRestoringAcceptEncoding" enabled="true" patternSyntax="Wildcard" stopProcessing="false">
                    <match filterByTags="A, Link, Script" pattern="/myapp/myisapi.dll/m/unipackages-7.0.0/*" />
                    <action type="Rewrite" value="https://mycdn.example.com/unipackages-7.0.0/{R:1}" />
                </rule>
                
            </outboundRules>
        </rewrite>
        <urlCompression doStaticCompression="true" />
    </system.webServer>
</configuration>
 

 

 

 

Many thx Mehmet.

Sure, you will save us times and lost white hairs. i will test your solution.

God bless you.

Link to comment
Share on other sites

×
×
  • Create New...