Rails app not accessible through subdomain - ruby-on-rails

I have deployed a Rails 4 app onto a digitalocean server.
Stack is Nginx-Unicorn-Ubuntu 14.04.
I have a domain at say abc.com ( and this domain has another website hosted elsewhere )
I created a subdomain called support.abc.com, and pointed it to the digitalocean server.
When i head to support.abc.com, I get this result:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML4.01//EN""http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>support.abc.com</title>
</head>
<frameset rows="100%,*" border="0">
<frame src="http://<ip address of droplet>" frameborder="0" />
<frame frameborder="0" noresize />
</frameset>
<!-- pageok -->
<!-- 03 -->
<!-- -->
</html>
When I access the app through the IP address of droplet, the app works fine.
Only when I head to support.abc.com I get the above page, which is basically a blank page.
How do i make it work?

Found a solution.
The problem wasn't with Rails.
The client had "forwarded" the subdomain to the IP instead of adding an A record.

Related

moving photos from resource/static/images to local drive

I am moving photos from resource/static/images. in spring boot to local drive d:\images
while the photos were in resource/static/images I used the following code to display them in Thymeleaf.
<img th:src="#{/images/one.jpg}">
now I have moved the photos to "d:\images" folder this following code line does not work:
<resources mapping="/resources/**" location="d:/images/three.jpg/" />
the question is, how can I access the photos from local "d:\images" folder?
I am using spring boot with thymeleaf to build a basic web site, to practice the skills I have gained through online courses I have completed. since I am new to creating web site, I am not sure I have any XML file, Spring boot might have created one for me. I was thinking to put the photos in mysql table, but they might make the table heavy to load to web browser. I read somewhere that you can put the photos on the local desk drive such as c: or d: drive. or you put the photos in a folder in server, the problem is have no clue how to do it.
here my html:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>sport for all </title>
<a th:href="#{index}">Main Page</a>
</head>
<body>
<div>
<h1></h1>Hi
<p>
hello
hello
hello
</p>
<resources mapping="/resources/**" location="d:/images/three.jpg/" />
</div>
</body>
</html>
The simplest solution in Spring Boot would be to use the spring.resources.static-locations property:
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/,file:///D:/images/
Documentation
Tutorial
Similar question on SO

PNG files not found in ASAR

I have an Electron (1.7.10) application that is reporting it can't find 5 of 7 PNG files in my ASAR. All 7 PNGs are in the same folder, and 2 of them are displayed on screen fine. The other 5 report net::ERR_FILE_NOT_FOUND.
All src attributes for the img tags are dynamically generated and use relative paths (assets/images/MyImage.png). If I extract the ASAR, I can see the files in there, in the correct folder (as referenced by the src attribute).
If I use the console to set the location of my browser to one of the images (document.location.href = "file:///path/to/app.asar/dist/assets/images/MyImage.png") I get the same results - 2 of 7 show OK.
Before packaging my application (with electron-builder), all images show correctly.
Let me guess, you are building a react SPA using react-router, and BrowserRouter?
If so, use HashRouter instead. Electron does not work with SPA's route by default, because a SPA route changes, but the resource path is always relative to index.html.
I haven't evaluated the other answers, but for my particular case, an extremely solution worked. I don't believe this is well documented, so it might be fairly common for people to still encounter this issue. For my particulars, the relevant problem and solution were identified here.
To address, add <base href='./' /> to the index.html (or whatever your starting html file is that hosts your SPA). This is a complete example of mine:
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<base href="./" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<meta
http-equiv="Content-Security-Policy"
content="script-src 'Self' 'unsafe-inline';"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
</body>
</html>
const path = require('path');
path.join(__dirname, 'assets/images/MyImage.png');

Browse Another Website Inside MVC Application

I have an existing web application which I want to display inside my new application, so as to the complete application works inside the new application.
In the image i've attached google.com so on search of something is should show the result or even open the website.
I'm not sure how to achieve that.
One way I found is IFrame, so would I to know any other possibilities are their as I do want to use IFrame
Attaching an Image for an example
Thanks in advance.
Maybe you can use something like fancybox tools. http://fancyapps.com/fancybox/#examples
But usually these tools are also using iframes. Maybe you can find another way for fancybox.
edit:Embed an External Page Without an Iframe?
edit 2: did you try this?
http://www.felgall.com/noiframe.htm
<html>
<head>
<title>example</title>
</head>
<body>
Ilker Test
<br />
<!--[if lte IE 6]>
<object classid="CLSID:25336920-03F9-11CF-8FD0-00AA00686F13"
data="http://www.w3schools.com/html/html_examples.asp" style="height:800px; width:1200px; overflow:hidden;">
</object>
<![endif]-->
<!--[if gte IE 7]><!-->
<object type="text/html" data="http://www.w3schools.com/html/html_examples.asp"
style="height:800px; width:1200px;">
<p>Alternate text.</p>
</object>
<!--><![endif]-->
</object>
</body>

Why does this webpage display differently when URL forwarded?

I have a simple Google maps web application I'm working on. I have purchased a domain name for the application (http://www.jcunav.com), which during my testing, is designed to simply forward to a page which is hosted on my another domain name of mine (http://www.codeemporium.com/experiments/map5.html). Testing on my Android Nexus S, I am noticing strange behaviour however - if I visit http://www.codeemporium.com/experiments/map5.html directly, then the app displays as intended - the map is the size I want and clicking the "About" link brings up a dialog the size I want. If I visit http://www.jcunav.com however (which, keep in mind, simply forwards to http://www.codeemporium.com/experiments/map5.html), the map displays at what looks like a more zoomed out level, and pressing the "About" link at the bottom of the page shows a dialog box which also appears more zoomed out. My question is, what could be causing this to occur, given that all http://www.jcunav.com is doing is forwarding to http://www.codeemporium.com/experiments/map5.html...
Are you certain you aren't frame-forwarding? I examined the page in firebug for each of the links you provided and it appears to me that you are frame-forwarding the URL. This results in your target page being 'wrapped' in a frame when presented to the end user. Odds are high that this is why it is not working for you.
Here is a somewhat lossy version of what is in the forwarded page:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>JCU Nav</title>
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</head>
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">
<frame name="MYTOPFRAME" src="http://www.codeemporium.com/experiments/map5.html" noresize>
-- snip --
</frameset>
</html>
Notice the frame tag:
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">
<frame name="MYTOPFRAME" src="http://www.codeemporium.com/experiments/map5.html" noresize>
This is what happens when you frame forward.
Since your sizing relies on additions to the HTML tag:
<html class="ui-mobile landscape min-width-320px min-width-480px min-width-768px min-width-1024px">
They do not work in the frame-forwarded version because they are nested inside the frame and not on the root page.
That's because http://www.jcunav.com is not forwarding to http://www.codeemporium.com/experiments/map5.html, it is loading it into a frame:
C:\Documents and Settings\blah>wget -S -O - http://www.jcunav.com/
--01:05:21-- http://www.jcunav.com/
=> `-'
Resolving www.jcunav.com... 66.150.161.141, 69.25.27.173, 63.251.171.80, ...
Connecting to www.jcunav.com|66.150.161.141|:80... connected.
HTTP request sent, awaiting response...
HTTP/1.1 200 OK
Date: Sun, 01 May 2011 05:01:11 GMT
Server: Apache/2.0.49 (Unix) PHP/4.3.9
X-Powered-By: PHP/4.3.9
Content-Length: 823
Connection: close
Content-Type: text/html; charset=ISO-8859-1
Length: 823 [text/html]
0% [ ] 0 --.--K/s <
!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>JCU Nav</title>
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</head>
<frameset frameborder="0" framespacing="0" border="0" rows="100%,*">
<frame name="MYTOPFRAME" src="http://www.codeemporium.com/experiments/map5.html" noresize>
<noframes>
<body>
<h1>JCU Nav</h1>
<br>
<br>
<br>
Click here to enter <a href="http://www.codeemporium.com/experiments/map5.html">http://www.codeemporium.com/e
xperiments/map5.html</a>
<hr>
| Domain Name Registration and Domain Name Forwarding by <a href="http://www.mydomain.com">mydomain.com - Register your
domain name</a>
</body>
</noframes>
</frameset>
</html>
You'll need to actually change that frame set to do the right thing.

grails-ui plugin autocomplete component error

I'm programming a page that uses the grails-ui plugin "autocomplete" feature. It doesn't work and the error console shows the error "YAHOO is not defined"; searching the web I tried the following:
Install the yui2 ad 3 plugins
Uninstall the grails-ui plugin
reinstall the grails-ui plugin
With no luck.
Any ideas ? I'm using grails 1.2
Here's my gsp:
<%# page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<gui:resources components="autocomplete" />
<title>Sample title</title>
</head>
<body>
<h1>Sample line</h1>
<g:form action="autoespec" id="id1">
<gui:autoComplete
id="spec"
name="spec"
resultName="result"
labelField="name"
idField="id"
controller="inscripcion"
action="autoespec"
/>
<input type="text" name="query">
<input type="submit">
</g:form>
</body>
</html>
Added an input to check that the controller worked (it does).
You have to add a special class to your body.
<body class="yui-skin-sam">
...
It appears that you've got the tag namespaces wrong. Assuming you're using the latest richui plugin from http://www.grails.org/RichUI+Plugin and installed it using grails install-plugin richui you need the following tags:
<resource:autoComplete skin="default"/>
in the page head and for the autocomplete box itself:
<richui:autoComplete ... />
I also notice that the attributes you're using for the riuchui:autocomplete element are not in the documentation so you might want to give it another read: http://www.grails.org/RichUI+Plugin#AutoComplete
HTH

Resources