Skip to content

Commit 373b249

Browse files
committed
[Filing] Support both Secure/Plain websockets based on the App protocol
1 parent 5ce5f4e commit 373b249

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

nginx/nginx.conf

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ http {
2323
add_header Strict-Transport-Security 'max-age=31536000; includeSubDomains; preload';
2424

2525
# CSP
26-
add_header Content-Security-Policy "default-src 'self' blob:; script-src 'self' 'unsafe-inline' blob: data: https://tagmanager.google.com https://www.googletagmanager.com https://www.google-analytics.com https://*.cfpb.gov https://www.consumerfinance.gov; img-src 'self' blob: data: https://www.google-analytics.com https://raw.githubusercontent.com; style-src 'self' 'unsafe-inline'; font-src 'self' data:; object-src 'none'; frame-src 'self' https://www.youtube.com/ https://ffiec.cfpb.gov/; connect-src 'self' ws://*.cfpb.gov https://*.cfpb.gov https://www.consumerfinance.gov https://raw.githubusercontent.com https://ffiec-api.cfpb.gov https://ffiec.cfpb.gov https://*.mapbox.com https://www.google-analytics.com https://s3.amazonaws.com;";
26+
add_header Content-Security-Policy "default-src 'self' blob:; script-src 'self' 'unsafe-inline' blob: data: https://tagmanager.google.com https://www.googletagmanager.com https://www.google-analytics.com https://*.cfpb.gov https://www.consumerfinance.gov; img-src 'self' blob: data: https://www.google-analytics.com https://raw.githubusercontent.com; style-src 'self' 'unsafe-inline'; font-src 'self' data:; object-src 'none'; frame-src 'self' https://www.youtube.com/ https://ffiec.cfpb.gov/; connect-src 'self' ws://*.cfpb.gov wss://*.cfpb.gov https://*.cfpb.gov https://www.consumerfinance.gov https://raw.githubusercontent.com https://ffiec-api.cfpb.gov https://ffiec.cfpb.gov https://*.mapbox.com https://www.google-analytics.com https://s3.amazonaws.com;";
2727

2828
# Restrict referrer
2929
add_header Referrer-Policy "strict-origin";

src/App.jsx

+2
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,8 @@ const App = () => {
6060
<Route component={NotFound} />
6161
</Switch>
6262
{showFooter && <Footer config={config} />}
63+
{console.log(window.location)
64+
}
6365
</AppContext.Provider>
6466
)
6567
}

src/filing/actions/listenForProgress.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ export default function listenForProgress() {
5050
const wsBaseUrl = process.env.REACT_APP_ENVIRONMENT === 'CI'
5151
? `${window.location.hostname}:8080`
5252
: `${window.location.host}/v2/filing`
53+
54+
const socketType = window.location.protocol == 'https:' ? 'wss' : 'ws'
5355

5456
const wsProgressUrl = quarter
5557
? `/institutions/${lei}/filings/${year}/quarter/${quarter}/submissions/${sequenceNumber}/progress`
5658
: `/institutions/${lei}/filings/${year}/submissions/${sequenceNumber}/progress`
5759

58-
let socket = new WebSocket(`ws://${wsBaseUrl}${wsProgressUrl}`)
60+
let socket = new WebSocket(`${socketType}://${wsBaseUrl}${wsProgressUrl}`)
5961

6062
socket.onopen = (event) => {
6163
console.log('>>> Socket open! Listening for Progress...')

0 commit comments

Comments
 (0)