Skip to content

Commit

Permalink
Merge pull request #4504 from geoadmin/bug-PB-1269-cross-domain-policy
Browse files Browse the repository at this point in the history
PB-1269, PB-1241: Fix cross domain policy
  • Loading branch information
ltshb authored Dec 5, 2024
2 parents 08bf53f + 1e80791 commit 1916d21
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
3 changes: 3 additions & 0 deletions apache/wsgi-py3.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ RewriteRule ^${APACHE_ENTRY_PATH}/info.json ${APACHE_ENTRY_PATH}/static/info.jso

# Static for cross domain flash/arcgis
RewriteRule ^${APACHE_ENTRY_PATH}/(crossdomain.xml|clientaccesspolicy.xml) ${APACHE_ENTRY_PATH}/static/$1 [PT]
<LocationMatch ^${APACHE_ENTRY_PATH}/static/(crossdomain.xml|clientaccesspolicy.xml)>
Header set Content-type "text/x-cross-domain-policy"
</LocationMatch>

# New style config url (see mf-geoadmin3 #4687)
RewriteRule ^${APACHE_ENTRY_PATH}/configs/(de|fr|it|rm|en)/layersConfig\.json ${APACHE_ENTRY_PATH}/rest/services/all/MapServer/layersConfig?lang=$1 [PT]
Expand Down
6 changes: 0 additions & 6 deletions chsdi/response_callbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,3 @@ def add_cors_header(request, response):
response.headers['Access-Control-Allow-Origin'] = "*"
response.headers['Access-Control-Allow-Methods'] = request.registry.settings['request_method']
response.headers['Access-Control-Allow-Headers'] = "*"


def add_cross_domain_policy(request, response):
# Check if the request is a cross domain policy request
if request.path in ['/crossdomain.xml', '/clientaccesspolicy.xml']:
response.headers['Content-Type'] = 'text/x-cross-domain-policy'
2 changes: 0 additions & 2 deletions chsdi/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from chsdi.models.bod import get_translations
from chsdi.response_callbacks import add_default_cache_control
from chsdi.response_callbacks import add_cors_header
from chsdi.response_callbacks import add_cross_domain_policy


import logging
Expand Down Expand Up @@ -85,7 +84,6 @@ def log_request(event):
def setup_response_callbacks(event):
event.request.add_response_callback(add_default_cache_control)
event.request.add_response_callback(add_cors_header)
event.request.add_response_callback(add_cross_domain_policy)


@subscriber(NewResponse)
Expand Down

0 comments on commit 1916d21

Please sign in to comment.