{"id":80,"date":"2020-11-30T06:01:41","date_gmt":"2020-11-30T06:01:41","guid":{"rendered":"https:\/\/studios.nomoss.co\/blog\/?page_id=80"},"modified":"2023-07-06T11:03:48","modified_gmt":"2023-07-06T00:03:48","slug":"real-deal-bridge-sails-http-js","status":"publish","type":"page","link":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/","title":{"rendered":"Real Deal Bridge Sails Http.js"},"content":{"rendered":"\n<p>This is the http.js for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.<\/p>\n\n\n\n<p><a href=\"https:\/\/noblesteedgames.com\/blog\/production-unity-webgl-the-basics\/\">For more information, check out this blog post.<\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/**\n * HTTP Server Settings\n * (sails.config.http)\n *\n * Configuration for the underlying HTTP server in Sails.\n * (for additional recommended settings, see `config\/env\/production.js`)\n *\n * For more information on configuration, check out:\n * https:\/\/sailsjs.com\/config\/http\n *\/\n\nconst express = require('express');\n\nmodule.exports.http = {\n\n  middleware: {\n\n     order: &#91;\n      'cookieParser',\n      'session',\n      'unity',\n      'compress',\n      'poweredBy',\n      'skipper',\n      'router',\n      'www',\n      'favicon',\n     ],\n\n    \/\/Configure Skipper\n    skipper: require('skipper')({\n      maxWaitTimeBeforePassingControlToApp: 1000,\n    }),\n\n    \/\/Configure unity\n    unity: (function (){\n      console.log(\"Initializing Unity middleware\");\n      express.static.mime.define({'application\/wasm': &#91;'wasm']});\n\n      return function(req, res, next){\n\n        if(req.path.endsWith(\"unityweb\") || req.path.endsWith(\"wasm\")){\n          res.set(\"Content-Encoding\", \"gzip\");\n          res.set(\"Cache-Control\", \"max-age=0, no-cache, must-revalidate\");\n          res.set(\"Large-Allocation\", \"0\");\n        }\n\n        if(req.path.endsWith(\"zip\")){\n          res.set(\"Cache-Control\", \"max-age=0, no-cache, must-revalidate\");\n        }\n\n        return next();\n      };\n    })(),\n\n  },\n\n};\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>This is the http.js for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content. For more information, check out this blog post.<\/p>\n","protected":false},"author":1,"featured_media":933,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"ppma_author":[65],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Real Deal Bridge Sails Http.js | Noble Steed Games<\/title>\n<meta name=\"description\" content=\"The sample http.js code for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Real Deal Bridge Sails Http.js | Noble Steed Games\" \/>\n<meta property=\"og:description\" content=\"The sample http.js code for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/\" \/>\n<meta property=\"og:site_name\" content=\"Noble Steed Games\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/NobleSteedAU\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-06T00:03:48+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"900\" \/>\n\t<meta property=\"og:image:height\" content=\"378\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@NobleSteedAU\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/\",\"url\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/\",\"name\":\"Real Deal Bridge Sails Http.js | Noble Steed Games\",\"isPartOf\":{\"@id\":\"https:\/\/noblesteedgames.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg\",\"datePublished\":\"2020-11-30T06:01:41+00:00\",\"dateModified\":\"2023-07-06T00:03:48+00:00\",\"description\":\"The sample http.js code for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.\",\"breadcrumb\":{\"@id\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#primaryimage\",\"url\":\"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg\",\"contentUrl\":\"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg\",\"width\":900,\"height\":378,\"caption\":\"A flowchart about Readl Deal Bridge's server architecture, using Unity WebGL.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/noblesteedgames.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Real Deal Bridge Sails Http.js\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/noblesteedgames.com\/blog\/#website\",\"url\":\"https:\/\/noblesteedgames.com\/blog\/\",\"name\":\"Noble Steed Games\",\"description\":\"Stories from Development\",\"publisher\":{\"@id\":\"https:\/\/noblesteedgames.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/noblesteedgames.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/noblesteedgames.com\/blog\/#organization\",\"name\":\"Noble Steed Games\",\"url\":\"https:\/\/noblesteedgames.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/noblesteedgames.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/12\/PFP.jpg\",\"contentUrl\":\"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/12\/PFP.jpg\",\"width\":1374,\"height\":1374,\"caption\":\"Noble Steed Games\"},\"image\":{\"@id\":\"https:\/\/noblesteedgames.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/NobleSteedAU\",\"https:\/\/x.com\/NobleSteedAU\",\"https:\/\/www.instagram.com\/noblesteedau\/\",\"https:\/\/www.linkedin.com\/company\/18263569\/\",\"https:\/\/www.youtube.com\/channel\/UC-CE2Op8dEH0LET0t9Zw79g\",\"https:\/\/twitter.com\/NobleSteedAU\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Real Deal Bridge Sails Http.js | Noble Steed Games","description":"The sample http.js code for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/","og_locale":"en_US","og_type":"article","og_title":"Real Deal Bridge Sails Http.js | Noble Steed Games","og_description":"The sample http.js code for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.","og_url":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/","og_site_name":"Noble Steed Games","article_publisher":"https:\/\/www.facebook.com\/NobleSteedAU","article_modified_time":"2023-07-06T00:03:48+00:00","og_image":[{"width":900,"height":378,"url":"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_site":"@NobleSteedAU","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/","url":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/","name":"Real Deal Bridge Sails Http.js | Noble Steed Games","isPartOf":{"@id":"https:\/\/noblesteedgames.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#primaryimage"},"image":{"@id":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#primaryimage"},"thumbnailUrl":"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg","datePublished":"2020-11-30T06:01:41+00:00","dateModified":"2023-07-06T00:03:48+00:00","description":"The sample http.js code for our backend Real Deal Bridge server. This ensures the correct headers are set when serving Unity WebGL content.","breadcrumb":{"@id":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#primaryimage","url":"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg","contentUrl":"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/07\/Production-Unity-WebGL.jpg","width":900,"height":378,"caption":"A flowchart about Readl Deal Bridge's server architecture, using Unity WebGL."},{"@type":"BreadcrumbList","@id":"https:\/\/noblesteedgames.com\/blog\/real-deal-bridge-sails-http-js\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/noblesteedgames.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Real Deal Bridge Sails Http.js"}]},{"@type":"WebSite","@id":"https:\/\/noblesteedgames.com\/blog\/#website","url":"https:\/\/noblesteedgames.com\/blog\/","name":"Noble Steed Games","description":"Stories from Development","publisher":{"@id":"https:\/\/noblesteedgames.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/noblesteedgames.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/noblesteedgames.com\/blog\/#organization","name":"Noble Steed Games","url":"https:\/\/noblesteedgames.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/noblesteedgames.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/12\/PFP.jpg","contentUrl":"https:\/\/noblesteedgames.com\/blog\/wp-content\/uploads\/2023\/12\/PFP.jpg","width":1374,"height":1374,"caption":"Noble Steed Games"},"image":{"@id":"https:\/\/noblesteedgames.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/NobleSteedAU","https:\/\/x.com\/NobleSteedAU","https:\/\/www.instagram.com\/noblesteedau\/","https:\/\/www.linkedin.com\/company\/18263569\/","https:\/\/www.youtube.com\/channel\/UC-CE2Op8dEH0LET0t9Zw79g","https:\/\/twitter.com\/NobleSteedAU"]}]}},"_links":{"self":[{"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/pages\/80"}],"collection":[{"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/comments?post=80"}],"version-history":[{"count":2,"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/pages\/80\/revisions"}],"predecessor-version":[{"id":956,"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/pages\/80\/revisions\/956"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/media\/933"}],"wp:attachment":[{"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/media?parent=80"}],"wp:term":[{"taxonomy":"author","embeddable":true,"href":"https:\/\/noblesteedgames.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=80"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}