Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PB-1269, PB-1241: Fix cross domain policy #4504

Merged
merged 1 commit into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading