Skip to content

Instantly share code, notes, and snippets.

@stek29
Last active October 6, 2021 11:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save stek29/ff25ee6aa50f9f50e90fc9b384c357c4 to your computer and use it in GitHub Desktop.
Save stek29/ff25ee6aa50f9f50e90fc9b384c357c4 to your computer and use it in GitHub Desktop.
kpms msx http based api hack for older webOS devices - for LE root cert expiry workaround
server {
listen 80;
server_name kp.local;
location = /msx/start.json {
proxy_pass https://kpms.cc;
proxy_http_version 1.1;
proxy_set_header Host "kpms.cc";
proxy_set_header Cookie "";
# disable gzip for sub_filter
proxy_set_header Accept-Encoding "";
proxy_hide_header Strict-Transport-Security;
sub_filter_types application/json;
sub_filter_once off;
sub_filter 'https://kpms.cc' $scheme://$host;
}
location /static/js/ {
proxy_pass https://kpms.cc;
proxy_http_version 1.1;
proxy_set_header Host "kpms.cc";
proxy_set_header Cookie "";
proxy_hide_header Strict-Transport-Security;
# disable gzip for sub_filter
proxy_set_header Accept-Encoding "";
sub_filter_types application/javascript;
sub_filter_once off;
sub_filter 'https://api.service-kp.com' $scheme://$host/A;
}
location /A/ {
proxy_pass https://api.service-kp.com/;
proxy_http_version 1.1;
proxy_set_header Host "api.service-kp.com";
proxy_set_header Cookie "";
proxy_hide_header Strict-Transport-Security;
access_log off;
proxy_cache off;
}
location ~ /A/v1/(items/media-links|tv) {
proxy_pass https://api.service-kp.com/v1/$1$is_args$args;
proxy_http_version 1.1;
proxy_set_header Host "api.service-kp.com";
proxy_set_header Cookie "";
proxy_hide_header Strict-Transport-Security;
access_log off;
proxy_cache off;
# disable gzip for sub_filter
proxy_set_header Accept-Encoding "";
sub_filter_types application/json;
sub_filter_once off;
sub_filter 'https://' 'http://';
}
location / {
proxy_pass https://kpms.cc;
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_hide_header Strict-Transport-Security;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Host "kpms.cc";
proxy_set_header Cookie "";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment