-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add CORS headers to fix issue with webfonts #169
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test that Access-Control-Allow-Origin
is being set?
aiohttp_devtools/runserver/serve.py
Outdated
@@ -350,6 +350,10 @@ def _insert_footer(self, response): | |||
response = web.Response(body=_404_msg.encode(), status=404, content_type='text/plain') | |||
status, length = response.status, response.content_length | |||
else: | |||
# Inject CORS headers to allow webfonts to load correctly | |||
response.headers['Access-Control-Allow-Methods'] = 'GET' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need Access-Control-Allow-Methods
? If so should we allow more methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this isn't required.
I think setting |
Needs #165 to be merged before this will pass. |
please rebase or merge to current master. |
For web browser to be able to load and apply webfonts to web page correctly from different domain, we need to add these Cross-origin Resource Sharing headers to static files served from devtools
2a9590e
to
97caf5d
Compare
Codecov Report
@@ Coverage Diff @@
## master #169 +/- ##
=========================================
+ Coverage 94.89% 94.9% +<.01%
=========================================
Files 12 12
Lines 764 765 +1
Branches 94 94
=========================================
+ Hits 725 726 +1
Misses 25 25
Partials 14 14
Continue to review full report at Codecov.
|
I'm not sure why Travis CI failed, though. |
Reuse |
@asvetlov I think if we only want to add a single header, adding |
I agree with @panuta people recent extra dependencies for devtools, seems unnecessary for one line. |
@panuta looks good, but can you add a tests to confirm that |
One extra dependency is not a problem, aiohttp-devtools already depends on many libs. But it's very minor issue, I agree with any your decision -- you are aiohttp-devtools author :) |
@samuelcolvin I've added the test. |
Great thanks very much. I'll wait a couple of days to make sure we don't get any errors on v0.7 then release a patch with this in. |
For web browser to be able to load and apply webfonts to web page correctly from different domain, we need to add these Cross-origin Resource Sharing headers to static files served from devtools