mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-02 09:15:19 -05:00
ugh
This commit is contained in:
@@ -16,18 +16,6 @@ gunicorn.SERVER_SOFTWARE = "None"
|
||||
|
||||
def on_starting(server):
|
||||
server.log.info("Starting Notifications API")
|
||||
from gunicorn.http.wsgi import Response
|
||||
|
||||
original_init = Response.__init__
|
||||
|
||||
def custom_init(self, *args, **kwargs):
|
||||
original_init(self, *args, **kwargs)
|
||||
self.headers = [
|
||||
(key, value) for key, value in self.headers if key.lower() != "server"
|
||||
]
|
||||
print(f"HEADERS {self.headers}")
|
||||
|
||||
Response.__init__ = custom_init
|
||||
|
||||
|
||||
def worker_abort(worker):
|
||||
@@ -44,6 +32,24 @@ def worker_int(worker):
|
||||
worker.log.info("worker: received SIGINT {}".format(worker.pid))
|
||||
|
||||
|
||||
# fix dynamic scan warning 10036
|
||||
def post_fork(server, worker):
|
||||
server.cfg.set(
|
||||
"secure_scheme_headers",
|
||||
{
|
||||
"X-FORWARDED-PROTO": "https",
|
||||
},
|
||||
)
|
||||
original_send = worker.wsgi.send
|
||||
|
||||
def custom_send(self, resp, *args, **kwargs):
|
||||
resp.headers.pop("Server", None)
|
||||
print(f"HEADERS!!!!!!!! {resp.headers}")
|
||||
return original_send(resp, *args, **kwargs)
|
||||
|
||||
worker.wsgi.send = custom_send.__get__(worker.wsgi, type(worker.wsgi))
|
||||
|
||||
|
||||
def fix_ssl_monkeypatching():
|
||||
"""
|
||||
eventlet works by monkey-patching core IO libraries (such as ssl) to be non-blocking. However, there's currently
|
||||
|
||||
@@ -93,7 +93,7 @@ class ResponseHeaderMiddleware(object):
|
||||
found_a_text_yaml = True
|
||||
|
||||
if found_a_text_yaml:
|
||||
headers.append(("Content-Type", "application/yaml"))
|
||||
headers.append(("Content-Type", "text/plain"))
|
||||
|
||||
print(headers)
|
||||
return start_response(status, headers, exc_info)
|
||||
|
||||
Reference in New Issue
Block a user