Alibaba Cloud Dynamic Route for CDN (DCDN) allows you to rewrite URL parameters in requests before the requests are redirected to origin servers. You can ignore, add, delete, retain, and modify parameters.
Background information
After you enable Alibaba Cloud DCDN to rewrite URL parameters in back-to-origin requests,
the query strings in URLs are rewritten. You can configure more than one rewrite rule.
Rewrite rules take effect in the following order: Add > Delete > Ignore Parameters or Reserve Only > Modify. If you configure more than one rewrite rule for the same parameter, only the rewrite
rule with the highest priority takes effect.
Note The Ignore Parameters and Reserve Only rules conflict with each other. Do not configure both for the same URL at the same
time.
Precautions
URL parameter rewrite rules may conflict with the
enhance break
rule of Rewrite URIs in back-to-origin requests and Configure parameter filtering. Make sure that the rules do not conflict with each other. The most recent configuration
takes effect.
Note
- URL parameters in back-to-origin requests are rewritten on DCDN back-to-origin nodes. The internal DCDN links are not affected, and the cache keys remain unchanged.
- Parameter filtering is completed on DCDN nodes. The internal DCDN links are affected, and the cache keys are rewritten.
Procedure
Configuration examples
-
Example 1: Ignore all URL parameters
Parameter Example Ignore Parameters Enabled Add None Delete None Reserve Only None Modify None Expected result Original request: http://example.com/index.html?code1=1&code2=2&code3=3
Final request:
http://example.com/index.html
-
Example 2: Retain specified parameters
Parameter Example Ignore Parameters Enabled Add None Delete None Reserve Only code2 Modify None Expected result Original request: http://example.com/index.html?code1=1&code2=2&code3=3
Final request:
http://example.com/index.html?code2=2
-
Example 3: Add, delete, and modify specified parameters
Parameter Example Ignore Parameters Enabled Add code4=4 Delete code2 Reserve Only None Modify code3=0 Expected result Original request: http://example.com/index.html?code1=1&code2=2&code3=3
Final request:
http://example.com/index.html?code1=1&code3=0&code4=4