Skip to content

nginx reverse proxying #122

Description

@h1nk

I saw some of the alternative instances are hosted behind Apache or nginx. I have had absolutely no success getting libreddit to work with nginx. I've been trying the following configuration to no avail:

server {
listen 443 ssl http2;
server_name libreddit.${NGINX_HOST};
location / {
set $libreddit http://libreddit:8080;
proxy_pass $libreddit;
}
}

I get a bad gateway on each index hit: [error] 34#34: *93 upstream prematurely closed connection while reading response header from upstream

I'm running my instance from Docker and building the image off the latest master commit. The instance is accessible from both containers:

root@nginx:/# curl -I libreddit:8080
HTTP/1.1 200 OK
content-length: 36365
content-security-policy: default-src 'none'; manifest-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; base-uri 'none'; img-src 'self' data:; form-action 'self'; frame-ancestors 'none';
content-type: text/html
date: Tue, 16 Feb 2021 20:09:31 GMT
referrer-policy: no-referrer
x-content-type-options: nosniff
x-frame-options: DENY
root@libreddit:/usr/src/libreddit# curl -I localhost:8080
HTTP/1.1 200 OK
content-length: 36365
content-security-policy: default-src 'none'; manifest-src 'self'; media-src 'self'; style-src 'self' 'unsafe-inline'; base-uri 'none'; img-src 'self' data:; form-action 'self'; frame-ancestors 'none';
content-type: text/html
date: Tue, 16 Feb 2021 20:11:40 GMT
referrer-policy: no-referrer
x-content-type-options: nosniff
x-frame-options: DENY

Any help getting this configuration to work would much appreciated.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions