creativecommons / creativecommons.org

Legacy legal code translations and general support issues
MIT License
155 stars 201 forks source link

Fix hash `#` escaping in donation redirect #1191

Closed zackkrida closed 3 years ago

zackkrida commented 3 years ago

Currently creativecommons.org/donate is meant to redirect to https://www.classy.org/give/313412#!/donation/checkout, but there is an issue where the # character is escaped to %23:

Label URL
expected: https://www.classy.org/give/313412#!/donation/checkout
actual: https://www.classy.org/give/313412%23!/donation/checkout

Possible fixes:

I don't know enough about saltstack + our specific usage to fix this. In RewriteRules we could fix this with the [NE] flag.

Reproduction

  1. See error.

Expectation

Screenshots

Environment

Additional context

Resolution

TimidRobot commented 3 years ago

Example test command:

http -h https://creativecommons.org/donate
HTTP/1.1 301 Moved Permanently
Age: 0
CF-Cache-Status: DYNAMIC
CF-RAY: 5fc601b13aded346-LAX
Connection: keep-alive
Content-Type: text/html; charset=iso-8859-1
Date: Fri, 04 Dec 2020 13:52:13 GMT
Expect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
Location: https://classy.org/give/313412/%23!/donation/checkout
Server: cloudflare
Set-Cookie: __cfduid=dc6ffce4361c60fc5cec56524d4e145041607089932; expires=Sun, 03-Jan-21 13:52:12 GMT; path=/; domain=.creativecommons.org; HttpOnly; SameSite=Lax
Strict-Transport-Security: max-age=15768000
Transfer-Encoding: chunked
Via: 1.1 varnish (Varnish/5.0)
X-Content-Type-Options: nosniff
X-Frame-Options: deny
X-Varnish: 400501355
X-XSS-Protection: 1; mode=block
cf-request-id: 06cf9f62c10000d346ec92f000000001
TimidRobot commented 3 years ago

The redirect in question is:

RewriteRule ^/donate/?$ https://classy.org/give/313412/#!/donation/checkout [R=301,L]

(https://github.com/creativecommons/creativecommons.org/blob/master/config/creativecommons.org.conf#L620)