Trying to remove www from custom URL for a Heroku app - heroku

I purchased a domain from namecheap.com and have pointed it to my Heroku app successfully:
www.markrandhawa.com
I'm now trying to prevent the www part from showing in the URL but having difficulty doing so. I've looked at the Heroku doc for adding custom domains and added the following code, but this hasn't worked:
heroku domains:add markrandhawa.com
In my namecheap account, I tried changing the '#' in 'All Host Records' to URL Frame but this didn't work either. When going into page source of markrandhawa.com, it said:
<frameset rows='100%, *' frameborder=no framespacing=0 border=0>
<frame src="http://www.markrandhawa.com/" name=mainwindow frameborder=no framespacing=0 marginheight=0 marginwidth=0></frame>
</frameset>
<noframes><h2>Your browser does not support frames. We recommend upgrading your browser.</h2><br><br>
<center>Click <a href="http://www.markrandhawa.com/" >here</a> to enter the site.</center>
</noframes>
I'm using Chrome.
However, when using a proxy, it seems as though my site is loading using mark.randhawa.com (without the www) as shown in the following link:
http://anonymouse.org/cgi-bin/anon-www.cgi/http://markrandhawa.com
I'm not sure what to try next.

Heroku has very limited support for hosting root domains. Your DNS provider must be able to set ALIAS records, which is something most services do not provide. If Namecheap does not provide this service, hosting your root domain on Heroku is not possible.
See https://devcenter.heroku.com/articles/custom-domains#root-domain for more information on configuring ALIAS records, or alternatively setting up a redirect proxy.

Related

Force HTTPS for app deployed in google app engine

If an application developed to support only HTTP. What configuration we should do in google app engine, that it force developer to have HTTPS support. We can add an entry(for handler) in "app.yaml", but in order to redirection. Just want to know anything else we can do to prevent such thing(in short should work with HTTPS only). Probably we can do something from ingress/loadbalancer/ssl etc but that's looks paid and don't want that currently.
You just have to set secure: always in app.yaml for your route handlers. Any call to your app from http will automatically get redirected to https
I was having trouble putting a whole site over HTTPS, so searching I found a solution that worked for me:
https://cloud.google.com/appengine/docs/standard/python3/config/appref
what it says is that you can change your app.yaml file and place in the handlers
- url: /.*
secure: always
redirect_http_response_code: 301
script: auto

How to make self hosted prebid server work with AMP?

The github repo does not mention any thing on how to use the self hosted server work with AMP . They have given an endpoint to access after storing the request in the server:
/openrtb2/amp?tag_id={ID} //id is the file name of request stored.
I do get the empty targeting response(since server is on local setup).But how will this data reach the amp page? where should this endpoint be requested?
I read in AMP docs that user generated js doesn't work in AMP. I also setup rtc config on amp ad tag and adding vendor as per vendor config(callout-vendor.js)which sends request to the bidder's prebid server url. For example:
If i add appnexus in rtc-config vendors, the request is getting sent to:
https://prebid.adnxs.com/pbs/v1/openrtb2/amp?tag_id={id of tag}
How do i make the request to go to self hosted prebid server url
ok, figured this thing out..
Doc reference: https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/rtc-publisher-implementation-guide.md#setting-up-rtc-config
So, first we make an amp-ad tag wherein we have rtc-config attribute. Since, we are using our own server, we'll need to add it in url property as mentioned in that example in doc.
<amp-ad width="320" height="50"
type="network-foo"
data-slot="/1234/5678"
rtc-config={"urls":["our-server-url"]}>
</amp-ad>
The targeting data returned by server will be fetched by amp-ad tag and will be appended to adserver request.
Additionally, we can make a pull request to amphtml repo on github to add our server url in callout-vendor.js file
file reference: https://github.com/ampproject/amphtml/blob/master/extensions/amp-a4a/0.1/callout-vendors.js
Then, the amp-ad tag will look like this:
<amp-ad width="320" height="50"
type="network-foo"
data-slot="/1234/5678"
rtc-config={"vendors": {"serverAliasAsSetInCalloutVendorFile": {"MACRO1": "MacroValue"}}>
</amp-ad>

Setting up HTTPS DNS with Namecheap and Heroku

I know there have been very similar questions asked but both companies changed over time and it's been hard to get a full working solution.
I'd like to have a naked subdomain (mysite.io) but if I have to have www.mysite.io, that's fine too.
So on the heroku dashboard I have :
DOMAIN NAME : mysite.io DNS TARGET : mysite.io.herokudns.com
DOMAIN NAME : www.mysite.io DNS TARGET www.mysite.io.herokudns.com
I know I should probably only have one of those active but I'm not sure which...
Then, on the NameCheap dashboard, I have :
EDIT: I have read what seemed like a good answer, here's what I changed, awaiting to see if it's gonna work.
CNAME Record - www - www.mysite.io.herokudns.com
CNAME Record - # - mysite.io.herokudns.com
And no redirect
I will update if it works
UPDATE :
Using two CNAME records indeed worked fine, except that users can still connect in HTTP and not be redirected to HTTPS. I probably need to add a redirect for that.
If anyone is still having problems and your website opens without HTTPS. There is a line of code in rails applications which you should uncomment. Go to config/environments/production.rb In this file you will find a commented line "config.force_ssl = true". Uncomment this line and your application will always open up with https
Combination of two answers above will solve the problem for Rails applications:
Go to Namecheap and add the two following CNAME's:
Type: CNAME
Host: #
Value: www.yourdomain.com.herokudns.com
TTL: Automatic
Type: CNAME
Host: www
Value: www.yourdomain.com.herokudns.com
TTL: Automatic
And then follow second answer: "Go to config/environments/production.rb In this file you will find a commented line "config.force_ssl = true"."
That should do the trick.

Heroku and subdomains

I have the domain ingledow.co.uk. I have recently been working on a Heroku app that is deployed to david.ingledow.uk and this has been done successfully.
However, I now want to redirect all my old domain and subdomains to david.ingledow.co.uk. Here is a list of domains I have that I want to redirect to my new subdomain:
ingledow.co.uk > david.ingledow.co.uk
www.ingledow.co.uk > david.ingledow.co.uk
blog.ingledow.co.uk > david.ingledow.co.uk
I've set CNAMEs to david.ingledow.co.uk. but I get the following error:
Heroku | No such app
There is no app configured at that hostname.
Perhaps the app owner has renamed it, or you mistyped the URL.
Any suggestions would be much appreciated!
If you're setting them as CNAME's then they are not redirects - it would be making your site available on www.ingledow.co.uk, blog.ingledow.co.uk. You'd have to add these all as custom domains to your application and then handle the redirect in your app. Instead you could set them up as redirects so when you go to blog.ingledow.co.uk you get redirected to david.ingledow.co.uk at DNS level.
See https://devcenter.heroku.com/articles/route-53#naked-root-domain for more info.

Hitting timeout using Recaptcha in ASP.NET Options

need some advice/help here.
I just started using the Recaptcha library of ASP.NET from this link
I've followed the simple guide on that page and it worked well with localhost deployment and development.
However, after I moved the same simple page with Recaptcha to my company's server to test the page out, I hit the below exception when trying to validate the recaptcha word.
The operation has timed out
I suspect it has something to do with SSL but my company's website
that I browse, isn't using https, it is just http. I have tried both
methods, having the recaptcha to set OverrideSecureMode to "true" - it
didn't work, set it to false, it didn't work as well (such as below)
<recaptcha:RecaptchaControl
ID="recaptchaControl1" runat="server"
OverrideSecureMode="True"
PublicKey="My_Public_Key"
PrivateKey="My_Private_Key"
/>
My code behind, I'm just using a simple button to invoke and display a
text which work on localhost in Visual Studio:-
if (Page.IsValid)
{
// do the stuff
}
else
// show the error message from recaptcha
What can I do to fix this issue?? Please help.
Sounds like a problem with firewall settings on your company servers. reCAPTCHA requires port 80 outbound (not inbound) to Google servers.

Resources