-
Notifications
You must be signed in to change notification settings - Fork 15
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 HTTPS to GraphQL and NextJS Server #376
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ module.exports = { | |
}, | ||
}, | ||
rules: { | ||
'no-console': 2, | ||
'no-empty': [ | ||
'error', | ||
{ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const { createServer } = require('https') | ||
const { parse } = require('url') | ||
const next = require('next') | ||
const fs = require('fs') | ||
const dev = process.env.NODE_ENV !== 'production' | ||
const app = next({ dev }) | ||
const handle = app.getRequestHandler() | ||
|
||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0 | ||
const httpsOptions = { | ||
key: fs.readFileSync('../server.key'), | ||
cert: fs.readFileSync('../server.crt'), | ||
} | ||
|
||
app.prepare().then(() => { | ||
createServer(httpsOptions, (req, res) => { | ||
const parsedUrl = parse(req.url, true) | ||
willwill96 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
handle(req, res, parsedUrl) | ||
}).listen(3000, err => { | ||
if (err) throw err | ||
// eslint-disable-next-line no-console | ||
console.log('> Ready on https://localhost:3000') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't CI have failed with this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i was able to add this to the eslint config for the app directory but not graphql. for some reason the no-console rule won't play nicely with typescript files |
||
}) | ||
}) |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||||||
import url from 'url' | ||||||||||
const defaultDdfUrl = 'https://localhost:8993' | ||||||||||
const defaultWebappUrl = 'http://localhost:3000' | ||||||||||
const defaultWebappUrl = 'https://localhost:3000' | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just realized, does the graphql server need to know about the webapp at all? This key should be able to be removed unless I'm missing something. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is used for the CORS policy. Would it be better to allow from all origins? revelio/graphql/src/apollo-server/index.tsx Lines 63 to 66 in 941149b
|
||||||||||
const parsableAttributes: Record<string, any> = { | ||||||||||
FETCH_ORIGIN: () => | ||||||||||
process.env['FETCH_ORIGIN'] && url.parse(process.env['FETCH_ORIGIN']), | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2092,6 +2092,11 @@ http-errors@^1.7.3, http-errors@~1.7.2: | |
statuses ">= 1.5.0 < 2" | ||
toidentifier "1.0.0" | ||
|
||
https@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/https/-/https-1.0.0.tgz#3c37c7ae1a8eeb966904a2ad1e975a194b7ed3a4" | ||
integrity sha1-PDfHrhqO65ZpBKKtHpdaGUt+06Q= | ||
|
||
[email protected], iconv-lite@^0.4.24, iconv-lite@~0.4.13: | ||
version "0.4.24" | ||
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
Bag Attributes | ||
friendlyName: localhost | ||
localKeyID: 54 69 6D 65 20 31 35 38 39 38 33 37 36 35 34 33 34 37 | ||
subject=/CN=localhost | ||
issuer=/C=US/ST=AZ/O=DDF/OU=Dev/CN=DDF Demo Root CA/[email protected] | ||
-----BEGIN CERTIFICATE----- | ||
MIICsjCCAhugAwIBAgIGAWBQwru6MA0GCSqGSIb3DQEBCwUAMIGEMQswCQYDVQQG | ||
EwJVUzELMAkGA1UECBMCQVoxDDAKBgNVBAoTA0RERjEMMAoGA1UECxMDRGV2MRkw | ||
FwYDVQQDExBEREYgRGVtbyBSb290IENBMTEwLwYJKoZIhvcNAQkBFiJlbWFpbEFk | ||
ZHJlc3M9ZGRmcm9vdGNhQGV4YW1wbGUub3JnMCAXDTE3MTIxMjE2NDM0N1oYDzIx | ||
MTcxMjEyMTY0MzQ3WjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3 | ||
DQEBAQUAA4IBDwAwggEKAoIBAQDEwOqpKuMr+GmiT3kKcMKp4361ByVBaxvj5M6r | ||
ptn+Al8oOZfxfaDOhOikUVuaPTuIYvTWW04KaQNHI3nm86RwldbwMlPZka5jGeYk | ||
OJ3qah1C6OMmMDEC7lM0/bhxPLc8C0cUwAG8FdlBLDKCYFjHj6UBq5xhD/1uJyvS | ||
oWcFqJQbXP+igVV7tDdRxRDhp8f5eActecjQXK5+bpzNs8KC+3gvnhBj/ux/DYyr | ||
E6iA4nKMnelIaZjhW11bsuQwM6XK8Tq7PQ2LuAuhFoKUq/p8p8Sva75/3nGeCHOl | ||
cjj7rnoSCcUgX+u1nnCN/wsshyRAX30wS7C75nQilQkxCfAlAgMBAAGjGDAWMBQG | ||
A1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOBgQAQBBked2MsqlmI | ||
wxSUXLee6f9R14GPsNsOkLohFhBTKuxC++n+q0+LvMRLmFxPj4dois/dHKQiD7wY | ||
WYY4WPvb3nD2aPev4NZm8erB9+XPVueRzxaLXQ+K1oW9Kjui8+2q1lTBBGOjma1D | ||
T/b6FVhyJo5SjQ3JMKe9TACVp/YA7A== | ||
-----END CERTIFICATE----- | ||
Bag Attributes | ||
friendlyName: 1.2.840.113549.1.9.1=#1622656d61696c416464726573733d646466726f6f746361406578616d706c652e6f7267,CN=DDF Demo Root CA,OU=Dev,O=DDF,ST=AZ,C=US | ||
subject=/C=US/ST=AZ/O=DDF/OU=Dev/CN=DDF Demo Root CA/[email protected] | ||
issuer=/C=US/ST=AZ/O=DDF/OU=Dev/CN=DDF Demo Root CA/[email protected] | ||
-----BEGIN CERTIFICATE----- | ||
MIIDdzCCAuCgAwIBAgIJAL0PQLifiHRgMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYD | ||
VQQGEwJVUzELMAkGA1UECBMCQVoxDDAKBgNVBAoTA0RERjEMMAoGA1UECxMDRGV2 | ||
MRkwFwYDVQQDExBEREYgRGVtbyBSb290IENBMTEwLwYJKoZIhvcNAQkBFiJlbWFp | ||
bEFkZHJlc3M9ZGRmcm9vdGNhQGV4YW1wbGUub3JnMCAXDTE1MTIxMTEzNDM1MloY | ||
DzIxMTUxMTE3MTM0MzUyWjCBhDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkFaMQww | ||
CgYDVQQKEwNEREYxDDAKBgNVBAsTA0RldjEZMBcGA1UEAxMQRERGIERlbW8gUm9v | ||
dCBDQTExMC8GCSqGSIb3DQEJARYiZW1haWxBZGRyZXNzPWRkZnJvb3RjYUBleGFt | ||
cGxlLm9yZzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtW0UkhViBv7Tv+MF | ||
nUpdlULG5/SFSg4w7Da9gnxWqFLvnlJ/vipFxVo+bwFytZUbzQ5261e3M/7KWc7+ | ||
2Oav6bLGwqemh1dlwuoLNATnyuHntsUlEAlKOomOfL4kFLLQx0jc20lLfJWatSBl | ||
FUd0iq5gE8yPEjGBGxPbfQXUyd8CAwEAAaOB7DCB6TAdBgNVHQ4EFgQU4VTHl98K | ||
wr+pX3heOwsr5EgXvcYwgbkGA1UdIwSBsTCBroAU4VTHl98Kwr+pX3heOwsr5EgX | ||
vcahgYqkgYcwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJBWjEMMAoGA1UEChMD | ||
RERGMQwwCgYDVQQLEwNEZXYxGTAXBgNVBAMTEERERiBEZW1vIFJvb3QgQ0ExMTAv | ||
BgkqhkiG9w0BCQEWImVtYWlsQWRkcmVzcz1kZGZyb290Y2FAZXhhbXBsZS5vcmeC | ||
CQC9D0C4n4h0YDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAGrhV8Rw | ||
RxMiPppXNA0/4zc7g0tKtjggObLMMQhJeIAvIrbjNx0VoX3/fLXDC6KwTCnJaeQ7 | ||
IKT4fpw31i/2s2gCjecLgDRVR7YFWs37dEJxqWeRyNM5/BYCodwkoNFDqDG89Fms | ||
M3xsPGUNuzXMUnXTncGcqEiJo0RayTHZYzvN | ||
-----END CERTIFICATE----- | ||
Bag Attributes | ||
friendlyName: ddf demo root ca | ||
2.16.840.1.113894.746875.1.1: <Unsupported tag 6> | ||
subject=/C=US/ST=AZ/O=DDF/OU=Dev/CN=DDF Demo Root CA/[email protected] | ||
issuer=/C=US/ST=AZ/O=DDF/OU=Dev/CN=DDF Demo Root CA/[email protected] | ||
-----BEGIN CERTIFICATE----- | ||
MIIDdzCCAuCgAwIBAgIJAL0PQLifiHRgMA0GCSqGSIb3DQEBCwUAMIGEMQswCQYD | ||
VQQGEwJVUzELMAkGA1UECBMCQVoxDDAKBgNVBAoTA0RERjEMMAoGA1UECxMDRGV2 | ||
MRkwFwYDVQQDExBEREYgRGVtbyBSb290IENBMTEwLwYJKoZIhvcNAQkBFiJlbWFp | ||
bEFkZHJlc3M9ZGRmcm9vdGNhQGV4YW1wbGUub3JnMCAXDTE1MTIxMTEzNDM1MloY | ||
DzIxMTUxMTE3MTM0MzUyWjCBhDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkFaMQww | ||
CgYDVQQKEwNEREYxDDAKBgNVBAsTA0RldjEZMBcGA1UEAxMQRERGIERlbW8gUm9v | ||
dCBDQTExMC8GCSqGSIb3DQEJARYiZW1haWxBZGRyZXNzPWRkZnJvb3RjYUBleGFt | ||
cGxlLm9yZzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAtW0UkhViBv7Tv+MF | ||
nUpdlULG5/SFSg4w7Da9gnxWqFLvnlJ/vipFxVo+bwFytZUbzQ5261e3M/7KWc7+ | ||
2Oav6bLGwqemh1dlwuoLNATnyuHntsUlEAlKOomOfL4kFLLQx0jc20lLfJWatSBl | ||
FUd0iq5gE8yPEjGBGxPbfQXUyd8CAwEAAaOB7DCB6TAdBgNVHQ4EFgQU4VTHl98K | ||
wr+pX3heOwsr5EgXvcYwgbkGA1UdIwSBsTCBroAU4VTHl98Kwr+pX3heOwsr5EgX | ||
vcahgYqkgYcwgYQxCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJBWjEMMAoGA1UEChMD | ||
RERGMQwwCgYDVQQLEwNEZXYxGTAXBgNVBAMTEERERiBEZW1vIFJvb3QgQ0ExMTAv | ||
BgkqhkiG9w0BCQEWImVtYWlsQWRkcmVzcz1kZGZyb290Y2FAZXhhbXBsZS5vcmeC | ||
CQC9D0C4n4h0YDAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4GBAGrhV8Rw | ||
RxMiPppXNA0/4zc7g0tKtjggObLMMQhJeIAvIrbjNx0VoX3/fLXDC6KwTCnJaeQ7 | ||
IKT4fpw31i/2s2gCjecLgDRVR7YFWs37dEJxqWeRyNM5/BYCodwkoNFDqDG89Fms | ||
M3xsPGUNuzXMUnXTncGcqEiJo0RayTHZYzvN | ||
-----END CERTIFICATE----- |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
Bag Attributes | ||
friendlyName: localhost | ||
localKeyID: 54 69 6D 65 20 31 35 38 39 38 33 36 39 34 36 38 38 31 | ||
Key Attributes: <No Attributes> | ||
-----BEGIN PRIVATE KEY----- | ||
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQDEwOqpKuMr+Gmi | ||
T3kKcMKp4361ByVBaxvj5M6rptn+Al8oOZfxfaDOhOikUVuaPTuIYvTWW04KaQNH | ||
I3nm86RwldbwMlPZka5jGeYkOJ3qah1C6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Hobdkp+uWeCa2p7wDqTp1kml9hRj8LqYfT0UKBuVKalQgOcJSN | ||
luTtauxI/L9ExD97ymqm0uQ8IrNOIwJapquaehdRaImWN6RsVN/fwENxAoGAWw3E | ||
HW8admfUQvAJTIgjHv1LZlv8wpAUiiqgx5Uci6Iy2bJWnARsysimF6f0RzBeTTNY | ||
sQzI63LcvO5bYYMZ0BNBFkkY53YOGW7rqJdnOPuIbvCB+blUQQXNJdYtDWJAMlFu | ||
/7ntwcT+Fu8w9OtG7TjkbEdK88Qi0a22sH4T7b8CgYBDIpg9vTw5l2nrfCxkCVsr | ||
qNpuZ+Lgwsb/+N5HuGeUHywjxeoexEmCdhO0TXxivgCamYtUCKvVN4KtH9OJbYV1 | ||
NQJJaaNR4EpvGwVTig6MsblYRSMIJKOOCqVHXJlJqa0BYnb4aNe3cvsVzt0XPs9P | ||
Fwq2gWDfaqVB1Y0oBc6o0Q== | ||
-----END PRIVATE KEY----- |
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.
Isn't the point of https so we can now remove this line?
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.
since the ddf cert is self signed, we still need this to get past that auth rejection