Skip to content
This repository was archived by the owner on Oct 20, 2024. It is now read-only.
This repository was archived by the owner on Oct 20, 2024. It is now read-only.

invalid rewrite for Url with query #1

Description

@asida

I have folowing URL:

/ssl/nosso-app/uhul/PRX/CD/wms.cuzk.cz/wms.asp?version=1.3.0&CRS=EPSG:32633&REQUEST=GetMap&FORMAT=image/png&styles=&WIDTH=256&HEIGHT=256&TRANSPARENT=True&layers=KN&BBOX=488672,5510688,488928,5510944

that needs to be sent to ashx handler as:

/ssl/nosso-app/uhul/PRX/ReverseProxy.ashx?loc=wms.cuzk.cz/wms.asp&version=1.3.0&CRS=EPSG:32633&REQUEST=GetMap&FORMAT=image/png&styles=&WIDTH=256&HEIGHT=256&TRANSPARENT=True&layers=KN&BBOX=488672,5510688,488928,5510944

this url goes through few hard ruled firewalls and over another reverse proxy so must be well formed as best as possible ;-( and must keep original form of WMS request. By keep original form we dont need to keep specific client app code for apps behind reverse proxy that creates wms strings for various wms request types.

currently function IsMatch in file DefaultRuleAction.cs, uses property AbsolutePath that returns only location portion of URL, in my case:

/ssl/nosso-app/uhul/PRX/CD/wms.cuzk.cz/wms.asp

after replace with PathAndQuery property returns all, whole original URL, so after my change to code, I can match by this:

RewriteRule  ^/CD/([^?]+)\?(.*)$   /ReverseProxy.ashx?loc=$1&$2   [NC,L]

I believe that my version is correct, because it rewrites any URL, comparing to original version that rewrites only queryless URL. This update should be done in both IsMatch and Execute functions in file DefaultRuleAction.cs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions