Nginx Reverse-Proxy Only Working With Curl
I'm configuring my backend using nginx as a reverse-proxy for my node/express server, but cannot seem to get it to work.
Right now, if I use curl to ping my site (dcdocs.app) I get the following headers:
curl -I https://dcdocs.app
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Sat, 24 Nov 2018 03:32:24 GMT
content-type: text/html; charset=UTF-8
content-length: 388
x-powered-by: Express
accept-ranges: bytes
cache-control: public, max-age=0
last-modified: Mon, 19 Nov 2018 15:35:12 GMT
etag: W/"184-1672c9c7c51"
Using curl, the response body also returns my expected index file. However, when I visit this page on a web browser, I don't get any response.
Here's how I currently have my nginx.conf file configured:
user www-data;
worker_processes auto; # Spawn one process per core... To see #, use command nproc
events {
worker_connections 1024; # Number of concurrent requests per worker... To see #, use command ulimit -n
}
http {
include mime.types;
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name dcdocs.app;
index index.html;
ssl_certificate /etc/letsencrypt/live/dcdocs.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dcdocs.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://localhost:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
What is causing the problem here? What am I missing that's causing the page to not load in a browser? The browser currently just hangs if you try to visit the site.
Thanks!
ssl nginx https server reverse-proxy
add a comment |
I'm configuring my backend using nginx as a reverse-proxy for my node/express server, but cannot seem to get it to work.
Right now, if I use curl to ping my site (dcdocs.app) I get the following headers:
curl -I https://dcdocs.app
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Sat, 24 Nov 2018 03:32:24 GMT
content-type: text/html; charset=UTF-8
content-length: 388
x-powered-by: Express
accept-ranges: bytes
cache-control: public, max-age=0
last-modified: Mon, 19 Nov 2018 15:35:12 GMT
etag: W/"184-1672c9c7c51"
Using curl, the response body also returns my expected index file. However, when I visit this page on a web browser, I don't get any response.
Here's how I currently have my nginx.conf file configured:
user www-data;
worker_processes auto; # Spawn one process per core... To see #, use command nproc
events {
worker_connections 1024; # Number of concurrent requests per worker... To see #, use command ulimit -n
}
http {
include mime.types;
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name dcdocs.app;
index index.html;
ssl_certificate /etc/letsencrypt/live/dcdocs.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dcdocs.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://localhost:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
What is causing the problem here? What am I missing that's causing the page to not load in a browser? The browser currently just hangs if you try to visit the site.
Thanks!
ssl nginx https server reverse-proxy
maybe your browser is not HTTP2 compatible ?
– Eugène Adell
Nov 24 '18 at 8:15
I'm using the latest version of Chrome. Would more detail be helpful somehow?
– Harry Cramer
Nov 24 '18 at 22:39
You can use the developer tools by pressing F12 key, maybe you'll see what's happening.
– Eugène Adell
Nov 25 '18 at 7:44
add a comment |
I'm configuring my backend using nginx as a reverse-proxy for my node/express server, but cannot seem to get it to work.
Right now, if I use curl to ping my site (dcdocs.app) I get the following headers:
curl -I https://dcdocs.app
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Sat, 24 Nov 2018 03:32:24 GMT
content-type: text/html; charset=UTF-8
content-length: 388
x-powered-by: Express
accept-ranges: bytes
cache-control: public, max-age=0
last-modified: Mon, 19 Nov 2018 15:35:12 GMT
etag: W/"184-1672c9c7c51"
Using curl, the response body also returns my expected index file. However, when I visit this page on a web browser, I don't get any response.
Here's how I currently have my nginx.conf file configured:
user www-data;
worker_processes auto; # Spawn one process per core... To see #, use command nproc
events {
worker_connections 1024; # Number of concurrent requests per worker... To see #, use command ulimit -n
}
http {
include mime.types;
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name dcdocs.app;
index index.html;
ssl_certificate /etc/letsencrypt/live/dcdocs.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dcdocs.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://localhost:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
What is causing the problem here? What am I missing that's causing the page to not load in a browser? The browser currently just hangs if you try to visit the site.
Thanks!
ssl nginx https server reverse-proxy
I'm configuring my backend using nginx as a reverse-proxy for my node/express server, but cannot seem to get it to work.
Right now, if I use curl to ping my site (dcdocs.app) I get the following headers:
curl -I https://dcdocs.app
HTTP/2 200
server: nginx/1.14.0 (Ubuntu)
date: Sat, 24 Nov 2018 03:32:24 GMT
content-type: text/html; charset=UTF-8
content-length: 388
x-powered-by: Express
accept-ranges: bytes
cache-control: public, max-age=0
last-modified: Mon, 19 Nov 2018 15:35:12 GMT
etag: W/"184-1672c9c7c51"
Using curl, the response body also returns my expected index file. However, when I visit this page on a web browser, I don't get any response.
Here's how I currently have my nginx.conf file configured:
user www-data;
worker_processes auto; # Spawn one process per core... To see #, use command nproc
events {
worker_connections 1024; # Number of concurrent requests per worker... To see #, use command ulimit -n
}
http {
include mime.types;
server {
listen 80;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2;
server_name dcdocs.app;
index index.html;
ssl_certificate /etc/letsencrypt/live/dcdocs.app/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/dcdocs.app/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
location / {
proxy_pass http://localhost:3000;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
}
What is causing the problem here? What am I missing that's causing the page to not load in a browser? The browser currently just hangs if you try to visit the site.
Thanks!
ssl nginx https server reverse-proxy
ssl nginx https server reverse-proxy
asked Nov 24 '18 at 3:38
Harry CramerHarry Cramer
357215
357215
maybe your browser is not HTTP2 compatible ?
– Eugène Adell
Nov 24 '18 at 8:15
I'm using the latest version of Chrome. Would more detail be helpful somehow?
– Harry Cramer
Nov 24 '18 at 22:39
You can use the developer tools by pressing F12 key, maybe you'll see what's happening.
– Eugène Adell
Nov 25 '18 at 7:44
add a comment |
maybe your browser is not HTTP2 compatible ?
– Eugène Adell
Nov 24 '18 at 8:15
I'm using the latest version of Chrome. Would more detail be helpful somehow?
– Harry Cramer
Nov 24 '18 at 22:39
You can use the developer tools by pressing F12 key, maybe you'll see what's happening.
– Eugène Adell
Nov 25 '18 at 7:44
maybe your browser is not HTTP2 compatible ?
– Eugène Adell
Nov 24 '18 at 8:15
maybe your browser is not HTTP2 compatible ?
– Eugène Adell
Nov 24 '18 at 8:15
I'm using the latest version of Chrome. Would more detail be helpful somehow?
– Harry Cramer
Nov 24 '18 at 22:39
I'm using the latest version of Chrome. Would more detail be helpful somehow?
– Harry Cramer
Nov 24 '18 at 22:39
You can use the developer tools by pressing F12 key, maybe you'll see what's happening.
– Eugène Adell
Nov 25 '18 at 7:44
You can use the developer tools by pressing F12 key, maybe you'll see what's happening.
– Eugène Adell
Nov 25 '18 at 7:44
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454955%2fnginx-reverse-proxy-only-working-with-curl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53454955%2fnginx-reverse-proxy-only-working-with-curl%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
maybe your browser is not HTTP2 compatible ?
– Eugène Adell
Nov 24 '18 at 8:15
I'm using the latest version of Chrome. Would more detail be helpful somehow?
– Harry Cramer
Nov 24 '18 at 22:39
You can use the developer tools by pressing F12 key, maybe you'll see what's happening.
– Eugène Adell
Nov 25 '18 at 7:44