Skip to content
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

Reverse Proxy #30

Open
firestrife23 opened this issue Jun 10, 2022 · 2 comments
Open

Reverse Proxy #30

firestrife23 opened this issue Jun 10, 2022 · 2 comments

Comments

@firestrife23
Copy link

firestrife23 commented Jun 10, 2022

I can access pastefy just fine by going to http://192.168.0.10:9999, but I'm unable to access pastefy with NGINX reverse proxy and, I'm getting file download instead of rendered page... I never had this issue with other 70 containers.

Here's snippet of my docker compose

   pastefy:
     image: interaapps/pastefy:latest
     container_name: pastefy
     ports:
       - "9999:80"
     environment:
       HTTP_SERVER_PORT: 80
       HTTP_SERVER_CORS: "*"
       DATABASE_DRIVER: mysql
       DATABASE_NAME: pastefy
       DATABASE_USER: pastefy
       DATABASE_PASSWORD: XXXXXX
       DATABASE_HOST: mariadb
       DATABASE_PORT: 3306
       SERVER_NAME: "https://pastefy.XXXXX.com"

Snippet of my NGINX reverse proxy

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name pastefy.XXXXXX.com;

    include /config/nginx/ssl.conf;

    client_max_body_size 0;

    include /config/nginx/authelia-server.conf;

    location / {
        include /config/nginx/authelia-location.conf;
        include /config/nginx/proxy.conf;
        include /config/nginx/resolver.conf;
        set $upstream_app pastefy;
        set $upstream_port 80;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

    }
}

P.S. my nginx container can access any containers directly using the hostname without exposing external ports and the only thing being exposed to the internet is nginx's port 80 and 443.

@Optinux
Copy link

Optinux commented Jun 21, 2022

replace SERVER_NAME: "https://pastefy.XXXXX.com" with SERVER_NAME: http://localhost:XXXX with XXXX being your port

EDIT: im talking about the first config

@JulianFun123
Copy link
Member

The port given in proxy_pass is not the one set in the dockerfile.

It should be:

        set $upstream_app pastefy;
        set $upstream_port 9999;
        set $upstream_proto http;
        proxy_pass $upstream_proto://$upstream_app:$upstream_port;

9999 because of this line:

     ports:
       - "9999:80"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants