butlerx / wetty

Terminal in browser over http/https. (Ajaxterm/Anyterm alternative, but much better)
https://butlerx.github.io/wetty
MIT License
4.26k stars 670 forks source link

cannot embed wetty in iframe. #383

Closed AshutoshPatole closed 7 months ago

AshutoshPatole commented 2 years ago

This issue is still not fixed for me. Version 2.3.0

wetty.service

[Unit]
Description=WeTTY
After=network-online.target

[Service]
Type=simple
ExecStart=/bin/bash -c "wetty --host 0.0.0.0 -p 3000 --title 'Linux'  --allow-iframe"
Restart=always
RestartSec=2
TimeoutStopSec=5
SyslogIdentifier=wetty

[Install]
WantedBy=multi-user.target

curl -I output:

HTTP/1.1 200 OK
Server: nginx/1.14.1
Date: Thu, 10 Feb 2022 07:36:40 GMT
Content-Type: text/html; charset=utf-8
Content-Length: 1123
Connection: keep-alive
Content-Security-Policy: default-src 'self';script-src 'self' 'unsafe-inline' 'unsafe-eval';style-src 'self' 'unsafe-inline';font-src 'self' data:;connect-src 'self' ws://live.ashutoshpatole.me
X-DNS-Prefetch-Control: off
Expect-CT: max-age=0
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=15552000; includeSubDomains
X-Download-Options: noopen
X-Content-Type-Options: nosniff
X-Permitted-Cross-Domain-Policies: none
Referrer-Policy: no-referrer-when-downgrade
X-XSS-Protection: 0
ETag: W/"463-sU/26veHuUBEvMiP/7q1LeC8l5E"
Vary: Accept-Encoding

Adding x-frame-option to nginx results in duplicates x-frame-option headers.

# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    #  include http_headers.conf;
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    # add_header X-Frame-Options "ALLOW-FROM https://server.com";
    include             /etc/nginx/mime.types;
nginx.conf# For more information on configuration, see:
#   * Official English Documentation: http://nginx.org/en/docs/
#   * Official Russian Documentation: http://nginx.org/ru/docs/

user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;

# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;
}

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;
    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See http://nginx.org/en/docs/ngx_core_module.html#include
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    server {
        server_name  live.ashutoshpatole.me;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
        }

        # Necessary for Let's Encrypt Domain Name ownership validation
        location ~ /.well-known {
          allow all;
        }

        location /wetty {
            proxy_pass http://127.0.0.1:3000/wetty;
            #
            proxy_pass_request_headers on;
            #
            proxy_pass_request_headers on;
            #
            proxy_set_header Host $host;
            #
            proxy_http_version 1.1;
            #
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Protocol $scheme;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_set_header X-NginX-Proxy true;
            #
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection $http_connection;
            proxy_read_timeout 43200000;
            proxy_set_header X-Forwarded-Ssl on;
            #
            proxy_redirect off;
            proxy_buffering off;
           # add_header X-Frame-Options "ALLOW-FROM https://myserver.com";
        }
        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
   location = /50x.html {
        }

    listen [::]:443 ssl ipv6only=on; # managed by Certbot
    listen 443 ssl; # managed by Certbot
    ssl_certificate /etc/letsencrypt/live/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/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
}

}

Am I missing something else? @butlerx

Originally posted by @AshutoshPatole in https://github.com/butlerx/wetty/issues/368#issuecomment-1034585656

cupanoodles commented 1 year ago

Yarn installation. The --allow-iframe flag is not working.

Trying to get Wetty to work inside of Organizr.

Tried resolutions described in https://github.com/butlerx/wetty/issues/380 and that did not work.

github-actions[bot] commented 8 months ago

Stale issue message