Skip to content

Proxy forced to use http (non secure) #613

Closed

Description

@offtherailz

This line:
https://github.com/geosolutions-it/MapStore2/blame/master/web/client/libs/ajax.js#L117

forces the proxy to be called in http, non #https. We can replace http:// with // (protocol relative) but why change the relative url proxyUrl (that should be something like /mapstore/proxy/) with http(s)://currentdomain/mapstore/proxy ? It is the definition of domain relative path.

The only different behiviour happens when the proxyUrl is relative to the path (without the / on start) but in this case maybe it is wanted.

In my opinion we can remove this part

                if (proxyUrl.match(/^http(s)?:\/\//i) === null) {
                    proxyUrl = 'http://' + window.location.host + proxyUrl;
                }

Activity

  1. mbarto commented on May 25, 2016

    @mbarto
    Contributor

    We cannot remove this completely, we can change the rule to accept // starting urls as valid and not apply the replacement for those

  2. offtherailz commented on May 25, 2016

    @offtherailz
    MemberAuthor

    To clarify I report the various use cases:


    ProxyURL: /mapstore/proxy (domain relative)

    • window.location : http://some.domain/app => window.host : some.domain

    /mapstore/proxy => http://some.domain/mapstore/proxy (the same of keeping /mapstore/proxy)

    • window.location : https://some.domain/app => window.host : https://some.domain

    /mapstore/proxy => http://some.domain/mapstore/proxy

    This is allowed only if the domain has cors, otherwise it is forbidden by the browser. (keeping /mapstore/proxy will do the correct request to https://some.domain/mapstore/proxy )


    ProxyURL: mapstore/proxy (path relative)

    • window.location : http://some.domain/app => window.host : some.domain

    mapstore/proxy => http://some.domainmapstore/proxy This is an error (keeping /mapstore/proxy will work in this case, and if the relative proxyUrl is a configuration error)

    • window.location : https://some.domain/app => window.host : some.domain
      /mapstore/proxy => http://some.domainmapstore/proxy This is allowed only if the domain has cors, otherwise it is forbidden by the browser.(keeping /mapstore/proxy will work in this case, and if the relative proxyUrl is a configuration error)

    ProxyURL: http://someother.domain/mapstore/proxy (absolute)

    • window.location : http://some.domain/app
      http://someother.domain/mapstore/proxy => http://some.domain/mapstore/proxy (the same of keeping /mapstore/proxy)
    • host: https://some.domain
      http://someother.domain/mapstore/proxy => http://some.domain/mapstore/proxy This is allowed only if the domain has cors, otherwise it is forbidden by the browser. (keeping /mapstore/proxy will do the correct request to https://some.domain/mapstore/proxy )
      So in any case the check in the issue useless or even harmful. Can you find a use case when it is useful ?
  3. added a commit that references this issue on May 25, 2016
    d6a75dd
  4. self-assigned this
    on May 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions