• Print

Author Topic: HTML server quirks  (Read 5028 times)

0 Members and 1 Guest are viewing this topic.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
HTML server quirks
« on: January 01, 2017, 09:48:30 pm »
Ok, yes, I could go to the actual support forums for my server application, but, as I hate registering on forums just for a one off that I consider of extremely little consequence, as I use this server app for very minimal development work before actually copying to a sandbox domain on Dreamhost, I thought I'd bring this here in case anyone had any ideas or come across any quirks like this before.

Spouse and I have an app. It outputs search results and does certain stuff with it. We decided to also list sample images.
I've spent 2 hours to determine that it was NOT some PHP erroring or html output from it, but instead, it was my dev server not working the way I expect.
It's not allowing display of images src linked from another site.
Once I copied to dreamhost, the images displayed fine.

On a local machine, I'm using a free http server called Abyss (http://aprelium.com/) with PHP 5 cgi.
When I load the HTML below in it from my server: https://jamminr.punked.us/test_img.html
Firefox - no images or alternate text show
MS Internet Explorer 11 - images show fine
MS Edge - Alternate text shows with broken image
Iphone/Safari - Alternate text shows with broken image

Using Dreamhost, the images load fine (at least, tested on 2 of the above browsers)
( https://cp.catslitteringthehall.com/test_img.html )
If I doubleclick the file from Win file explorer from the local shared URI, it also loads the images fine, so, as you might expect, this leads me to believe with 98% certainty that it's my server app.

Question - Anyone here have any ideas why this server app might not allow loading images linked to another domain?
I have quite a bit of control of custom headers. I modified a header I thought might be causing it, but it didn't change.

Using example code;
Code: Text
  1. <!DOCTYPE html>
  2. <html lang="en">
  3.   <head>
  4.     <title>Silly json list testing</title>
  5.     <meta charset="utf-8" />
  6.   </head>
  7.   <body>
  8.      <ul>
  9.         <li><img src="https://img1.etsystatic.com/177/0/6683757/il_170x135.1133612953_xlbe.jpg" alt="Example image" /></li>
  10.         <li><a href="https://www.etsy.com/listing/460948572/the-original-i-drink-coffee-like-a?utm_source=creativespricing&utm_medium=api&utm_campaign=api">The Original, &quot;I Drink Coffee Like A Gilmore Girl&quot; - ToGo Travel Mug</a></li>
  11.         <li>$21.95</li>
  12.       </ul>
  13.  
  14.      <ul>
  15.         <li><img src="https://img0.etsystatic.com/101/0/12476437/il_170x135.1063461760_a78q.jpg" alt="Example image" /></li>
  16.         <li><a href="https://www.etsy.com/listing/485827917/wall-art-watercolor-stars-hollow-map?utm_source=creativespricing&utm_medium=api&utm_campaign=api">Wall Art Watercolor Stars Hollow Map Print,Gilmore Girls Print,Lorelai and Rory,Gazebo Gilmore Girls,Tv Show Poster,Luke&#38;#39;s Diner,Printable</a></li>
  17.         <li>$4.99</li>
  18.       </ul>
  19.      <ul>
  20.      <li><img src="https://img0.etsystatic.com/116/0/8046764/il_170x135.983066190_lywt.jpg" alt="Example image" /></li>
  21.      <li><a href="https://www.etsy.com/listing/397942865/drinking-coffee-like-a-gilmore-glitter?utm_source=creativespricing&utm_medium=api&utm_campaign=api">Drinking Coffee Like A Gilmore Glitter Travel Mug - Gilmore Girls Mug - Glitter Mug - Travel Cup - Glitter Tumbler - Travel Mug With Lid</a></li>
  22.         <li>$23.00</li>
  23.       </ul>
  24. </body>
  25. </html>
  26.  




"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: HTML server quirks
« Reply #1 on: January 02, 2017, 05:49:26 am »
Found my issue after starting fresh in the morning.
I had a theory that it was something to do with custom headers I'd added that https://securityheaders.io recommended.
(I added them with just a minimum knowledge behind them, and was using a policy too restrictive to allow images from other sites.)
I went down my list I'd added and found this descriptive page from Mozilla - https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP
The winning header was "Content-Security-Policy". I'd only allowed it to load content from my original domain.
And now we know.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2727
  • Karma: 430
    • |G4P| Gman4President
Re: HTML server quirks
« Reply #2 on: January 02, 2017, 05:41:53 pm »

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: HTML server quirks
« Reply #3 on: January 02, 2017, 07:31:03 pm »
One of those ducks is...just... so wrong.
But yes, thanks for the rubber duck debugging.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

  • Print