{"id":5077,"date":"2022-10-08T14:37:25","date_gmt":"2022-10-08T12:37:25","guid":{"rendered":"https:\/\/www.pschatzmann.ch\/home\/?p=5077"},"modified":"2022-10-08T14:47:30","modified_gmt":"2022-10-08T12:47:30","slug":"tinyhttp-storing-html-on-an-external-server","status":"publish","type":"post","link":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/","title":{"rendered":"TinyHttp &#8211; Storing Html on an External Server"},"content":{"rendered":"<p>In my <a href=\"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/07\/tinyhttp-a-simple-form-using-ajax\/\">last Blog<\/a>, I was showing how we can process <strong>html forms<\/strong> with the <a href=\"https:\/\/github.com\/pschatzmann\/TinyHttp\">Arduino TinyHttp library<\/a>. In the examples we were <strong>embedding the html into the source code<\/strong>.<\/p>\n<p>Sometimes however it is more convenient to store the <strong>html as files on a dedicated server<\/strong>: In the following examples we use <strong>Github<\/strong> for this.<\/p>\n<h2>Forwarding<\/h2>\n<p>In <a href=\"https:\/\/github.com\/pschatzmann\/TinyHttp\/blob\/main\/examples\/webservice\/webservice-html-dns\/webservice-html-dns.ino\">this example<\/a> we just forward to an external URL.<\/p>\n<pre><code>static Url forward_url(\"https:\/\/pschatzmann.github.io\/TinyHttp\/app\/webservice-example.html\");\nserver.on(\"\/\",GET, forward_url);\n<\/code><\/pre>\n<p>This <a href=\"https:\/\/github.com\/pschatzmann\/TinyHttp\/blob\/main\/docs\/app\/webservice-example.html\">external html page<\/a> contains logical names (with the serive_url = &#8216;http:\/\/esp32-service\/service&#8217;) to address the webervice.<\/p>\n<p>Therefore we just needed to add some additional DNS logic into the sketch.<\/p>\n<pre><code>\/\/ register the service name\nif (!MDNS.begin(\"esp32-service\")) {\n    Serial.println(\"Could not set up DNS\");\n    return; \n}\n<\/code><\/pre>\n<p>Github is using a https connection, but the webservice just uses http. This is <strong>insecure<\/strong> and we need to change the browser settings to <strong>allow this<\/strong>.<\/p>\n<h2>Tunnelling<\/h2>\n<p>In <a href=\"https:\/\/github.com\/pschatzmann\/TinyHttp\/blob\/main\/examples\/webservice\/webservice-html-tunnel\/webservice-html-tunnel.ino\">the next example<\/a> we use tunnelling to an external URL: the forwarding is hidden to the end user.<\/p>\n<pre><code>\/\/ forward address\nstatic HttpTunnel tunnel_url(\"https:\/\/pschatzmann.github.io\/TinyHttp\/app\/webservice-example-local.html\");\nserver.on(\"\/\",GET, tunnel_url);\n<\/code><\/pre>\n<p>This is a little bit less efficient then a simple forwarding, but it has the advantage that we do not have to worry about authentication or CORS, and the <a href=\"https:\/\/github.com\/pschatzmann\/TinyHttp\/blob\/main\/docs\/app\/webservice-example-local.html\">external html page<\/a> can use <strong>local addressing<\/strong> (with the serive_url = &#8216;\/service&#8217;) to specify the services!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my last Blog, I was showing how we can process html forms with the Arduino TinyHttp library. In the examples we were embedding the html into the source code. Sometimes however it is more convenient to store the html as files on a dedicated server: In the following examples [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5061,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","_import_markdown_pro_load_document_selector":0,"_import_markdown_pro_submit_text_textarea":"","_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[20],"tags":[37],"class_list":["post-5077","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-arduino","tag-tinyhttp"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>TinyHttp - Storing Html on an External Server - Phil Schatzmann<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"TinyHttp - Storing Html on an External Server - Phil Schatzmann\" \/>\n<meta property=\"og:description\" content=\"In my last Blog, I was showing how we can process html forms with the Arduino TinyHttp library. In the examples we were embedding the html into the source code. Sometimes however it is more convenient to store the html as files on a dedicated server: In the following examples [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/\" \/>\n<meta property=\"og:site_name\" content=\"Phil Schatzmann\" \/>\n<meta property=\"article:published_time\" content=\"2022-10-08T12:37:25+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-10-08T12:47:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/10\/httpserver.jpeg\" \/>\n\t<meta property=\"og:image:width\" content=\"225\" \/>\n\t<meta property=\"og:image:height\" content=\"225\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"pschatzmann\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"pschatzmann\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/\"},\"author\":{\"name\":\"pschatzmann\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"headline\":\"TinyHttp &#8211; Storing Html on an External Server\",\"datePublished\":\"2022-10-08T12:37:25+00:00\",\"dateModified\":\"2022-10-08T12:47:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/\"},\"wordCount\":197,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/httpserver.jpeg\",\"keywords\":[\"TinyHttp\"],\"articleSection\":[\"Arduino\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/\",\"name\":\"TinyHttp - Storing Html on an External Server - Phil Schatzmann\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/httpserver.jpeg\",\"datePublished\":\"2022-10-08T12:37:25+00:00\",\"dateModified\":\"2022-10-08T12:47:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/httpserver.jpeg\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/10\\\/httpserver.jpeg\",\"width\":225,\"height\":225},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/2022\\\/10\\\/08\\\/tinyhttp-storing-html-on-an-external-server\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"TinyHttp &#8211; Storing Html on an External Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#website\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/\",\"name\":\"Phil Schatzmann Consulting\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/home\\\/#\\\/schema\\\/person\\\/73a53638a4e34e8373405fd737dac9b1\",\"name\":\"pschatzmann\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"url\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"contentUrl\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\",\"width\":305,\"height\":305,\"caption\":\"pschatzmann\"},\"logo\":{\"@id\":\"https:\\\/\\\/www.pschatzmann.ch\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/pschatzmann.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"TinyHttp - Storing Html on an External Server - Phil Schatzmann","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:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/","og_locale":"en_US","og_type":"article","og_title":"TinyHttp - Storing Html on an External Server - Phil Schatzmann","og_description":"In my last Blog, I was showing how we can process html forms with the Arduino TinyHttp library. In the examples we were embedding the html into the source code. Sometimes however it is more convenient to store the html as files on a dedicated server: In the following examples [&hellip;]","og_url":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/","og_site_name":"Phil Schatzmann","article_published_time":"2022-10-08T12:37:25+00:00","article_modified_time":"2022-10-08T12:47:30+00:00","og_image":[{"width":225,"height":225,"url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/10\/httpserver.jpeg","type":"image\/jpeg"}],"author":"pschatzmann","twitter_card":"summary_large_image","twitter_misc":{"Written by":"pschatzmann","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#article","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/"},"author":{"name":"pschatzmann","@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"headline":"TinyHttp &#8211; Storing Html on an External Server","datePublished":"2022-10-08T12:37:25+00:00","dateModified":"2022-10-08T12:47:30+00:00","mainEntityOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/"},"wordCount":197,"commentCount":0,"publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/10\/httpserver.jpeg","keywords":["TinyHttp"],"articleSection":["Arduino"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/","url":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/","name":"TinyHttp - Storing Html on an External Server - Phil Schatzmann","isPartOf":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#primaryimage"},"image":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#primaryimage"},"thumbnailUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/10\/httpserver.jpeg","datePublished":"2022-10-08T12:37:25+00:00","dateModified":"2022-10-08T12:47:30+00:00","breadcrumb":{"@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#primaryimage","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/10\/httpserver.jpeg","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/10\/httpserver.jpeg","width":225,"height":225},{"@type":"BreadcrumbList","@id":"https:\/\/www.pschatzmann.ch\/home\/2022\/10\/08\/tinyhttp-storing-html-on-an-external-server\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pschatzmann.ch\/home\/"},{"@type":"ListItem","position":2,"name":"TinyHttp &#8211; Storing Html on an External Server"}]},{"@type":"WebSite","@id":"https:\/\/www.pschatzmann.ch\/home\/#website","url":"https:\/\/www.pschatzmann.ch\/home\/","name":"Phil Schatzmann Consulting","description":"","publisher":{"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pschatzmann.ch\/home\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.pschatzmann.ch\/home\/#\/schema\/person\/73a53638a4e34e8373405fd737dac9b1","name":"pschatzmann","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","url":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","contentUrl":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png","width":305,"height":305,"caption":"pschatzmann"},"logo":{"@id":"https:\/\/www.pschatzmann.ch\/wp-content\/uploads\/2022\/08\/pschatzmann.png"}}]}},"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/5077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/comments?post=5077"}],"version-history":[{"count":11,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/5077\/revisions"}],"predecessor-version":[{"id":5088,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/posts\/5077\/revisions\/5088"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media\/5061"}],"wp:attachment":[{"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/media?parent=5077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/categories?post=5077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pschatzmann.ch\/home\/wp-json\/wp\/v2\/tags?post=5077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}