URL Auto Appends path - browser

I have a problem in my URL in my browser.
If I type http://int-test.company.com/test.png
It automatically became http://int-test.company.com.company.com/test.png
But if I type using the host ip (for example 10.218.132.18/test.png) it works fine.
Also it only happens on one particular host name.
Have I configured something unknowingly in the browser settings?
Any idea why?
I've tried it in all browsers (IE, Google Chrome and Firefox) and encountered the same problem.
Thank you

I would suspect it's problem of your web server configuration rather than the browser. It probably contains some check that's supposed to redirect you to the canonical address, but the check is incorrect and adds the domain to URL that already contains it.
To check, have a chat with the server by hand. It's pretty easy. Take netcat (usually called just nc) or telnet or putty, direct them to the HTTP server port (using command like telnet int-test.company.com 80 (putty is an exception -- it has configuration dialog)) and type in
GET /test.png HTTP/1.1
Host: int-test.company.com
and a blank line. If the answer starts with number begining with 3 (300 to 303) and contains line like
Location: http://int-test.company.com.company.com/test.png
than that's the problem. Get the server administrator to fix the configuration. Correct answer should begin with digit 2 and after few lines be followed by lot of garbage, which is what PNG file dumped to the console looks like.

Related

ngrok does not load NodeJS app from outside (ERR_CONNECTION_TIMED_OUT)

ngrok is a program with which you can make a local tunnel, it generates a temporary domain for you so you can redirect people to your local content, and also use https via localhost.
https://ngrok.com/
localtunnel is just another alternative.
So I have set up either ngrok and a localtunnel but both show a white page with only the HTML loading and not css or js when loaded outside of my network (with data plan for example)
The problem is nothing gives an error, the only thing I can see is ERR_CONNECTION_TIMED_OUT when using a hotspot.
Everything works within my own network.
I have tried turning off the firewall already but it seems to make no difference, also tried looking with the chrome remote debugger but it just disconnects when I load the url.
Thing is when I go to https:// on the ngrok url I get a bunch of mixed content errors, but not when I go to http. Seem illogical to me that it would default to http when using a https link... all of my script/style tags are relative paths.
Anyway so far this is only thing that I can figure out, any ideas on what might cause this?
So it's either
ERR_CONNECTION_TIMED_OUT
or
Blocked loading mixed active content
or both?
So I go it working now by changing the base href.
<base href="http://yoururl.ngrok.io">
And also changing some paths in my config to either /app/ or ../ respectively, but most of these were already set correctly and all I did was revert them after changing the base url.
As far I understand now the problems only really start to occur when connecting to the url through a data plan and not wifi.
Some random image paths in css/js will not load, and it also appears to behave differently on Firefox and Chrome for some reason.
Problem is I cannot keep testing this indefinitely as data will obviously run out some time and I have no reliable way of debugging the console errors on mobile...
In conclusion it works on a "normal" connection now (ie Wifi/Cable) but not on data.

How to use domain name instead of local host IP with PHP

I'm experimenting some PHP code with a local IP address http://192.168.33.10.
When I was using the address in a form of number (192.168.33.10) it was working fine (see image 1), but when I try to use a domain name "dev.dotinstall.com", it reaches an error page (see image 2).
I learned that you can use a name like "dev.dotinstall.com" instead of IP address by editing hosts file, so I edited it adding a line "192.168.33.10 dev.dotinstall.com" at the end of the hosts file (see image 3).
The error page says "The fact that you are seeing this page indicates that the website you just visited is either experiencing problems or is undergoing routine maintenance.", but I don't know what the problem is.
Any idea why this is happening?
You are correct that you need to add the URL into the hosts file. Make sure you have saved it correctly (with administrator rights) and the port is correct.
This is not enough though, you will need to set up a virtual host for Apache as well and then restart Apache. If you only set the URL in the hosts file, then Apache will not know what to do with it. There are plenty of materials on setting up a virtual host for Apache on Windows if you search for that.

Locally setting up redirect to https://

I have read a few answers to try and find a solution to a ridiculous problem.
I dont have access to a server that I can log on to access phpmyadmin,
What is supposed to happen is that the web url is supposed to be viewed via https, and in most cases this happens.
Except for a particular PC I have at home and it never seems to open in https. Why this is happening on this given machine is completely unknown.
Is there a way I can set up a rule on my local machine that will ALWAYS convert http://pathtomysite.com to https://pathtomysecuresite.com, (possibly via the 'hosts' entry (and yes it is a windows machine running win10).
I could do this on the web server itself, I know how to do this, but the problem is, I don't have, nor am I allowed to have, access to the database server to update the .htaccess or webconfig.xml on the server. (I am 99% sure its Apache, not nginx or IIS).
Any help is allows gratefully received.

OpenCart 2.0.0. - SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data OK

In OpenCart v. 2.0.0 in /admin when I receive an order I should be able to change status of the order to let the customer know what is going on with her purchase. This functionality is in 'History' tab.
Unfortunately I can't change or modify any orders.
When I change the status and try to save it Openart gives me an error:
SyntaxError: JSON.parse: unexpected end of data at line 1 column 1 of the JSON data OK
It happens even on clean install. Everything is set up correctly - the domain name is OK, the shop is not in maintenance mode, there is no password in .htaccess file (BTW even removing it doesn't help).
It looks like in the screenshot attached.
The one solution is to install the newest version of OpenCart which is in the moment I'm writing this post 2.0.1.1. It's probably the best idea.
My problem is that I have made quite a lot of modifications and that would be very difficult for me. Making my changes I didn't use vqmod which probably I should use (but nobody is perfect - isn't she?).
Or maybe you don't want to go into upgrade for a different reason?
Now, how to resolve this problem without actually changing the software itself?
I got the same error and I fixed it:
Go to Admin -> System -> Users -> API
Add a new API generate password, and enable it
Then go to Admin -> System -> Settings -> Edit -> Option(tab)
Select API user under Checkout section as your API user
Then save the changes
Then go to Sales -> Orders -> Edit
I guess that the error comes when a cURL method in your OC tries to get data from the OC API and gets blocked.
-- Quick Testing
Goto function info() in /admin/controller/sale/order.php
find the curl initialization inside info() and aim on $json = curl_exec($curl);
add after that:
if($json === false){
var_dump(curl_error($curl));
exit;
}
if there is an error, you should see it when you go to an order info from your admin panel.
You may have a refused connection msg on 80 or 443 port.
If yes, possible errors and solutions may be:
You are working in a protected directory.
This is a website message (like js alert with fields) that asks for user/pass.
You may turn it off and try again to add a history record.
In Plesk you can find it as "Password Protected Directory" in domain options.
If you recently modify your .htaccess, you should check it for auth statements causing the above symptoms.
PHP; Check if you have added any $_SERVER['REMOTE_ADDR'] into an if block to reject ips on purpose.
When using Plesk, have root access (ssh), and you have the same website domain as the Plesk admin panel hostname,
(assume that your domain is www.yourdomain.com)
you can check from your ssh, executing curl -vv "http://www.yourdomain.com" (or https) inside of your own server (localhost) which your domain is hosted.
If you get a refused connection on port 80, or 443 for https and have a success return msg on curl -vv "http://www.yourdomain.com:7080" OR curl -vv "http://www.yourdomain.com:7081" (virtualhost ports) then you can fix it as below. It is also strange to get a successfull connection msg on 80 & 443 when try it from other server!
So, you have to modify your server hosts (/etc/hosts) and add right to your public ip your full website domain (last line usually).
So, add to the public-ip line xxx.xxx.xxx.xxx www.yourdomain.com. You may have other hosts defined right on your public ip. Please, do not remove any. Add www.yourdomain.com in the last of the piblic-ip line. You can check again with curl, or adding an order history.
I may help,
giannisepp
After some hard time I managed to solve this problem and I want to share this solution with you:
In the admin panel of your shop go to:
Admin > Settings > Users > API
There should be one user with name like
XrpeYEWrFHOcqB1phjBXdUCRO1A3sCvDpgmTGBcJ7G6WuYIMKXCrIJUpzvFPfimWT6LHQLisTYz0nuOy7ZK
if there is not create one and give her reasonably complicated name like in the example.
Then you have to check out your database (using phpMyAdmin helps a lot) where keeps your store data.
find the api table which contains the API user and check the api_id of this user.
find table setting (by default OpenCart instalation it's named oc_setting) and find key config_api_id.
Set the value field to the same number as the api_id you had found in the api table.
Problem should be solved.
In my OpenCart 2.0.0 installation the value was set to 0 while the api_id was 2.
I had the same issue and tried all workarounds possible and imaginable.
In the end gave up and called my hosting provider. They found that OpenCart wont run properly on any php version above 5.4.33. Ergo: use php 5.4.33
This might not solve all issues, or might work only in conjunction with other fixes bove, but itÄs worth a try to check which php version your hosting is running by default.
If your server does not support HTTPS, please modify the https to http.
Open the admin/config.php file, modify the https to http.
define('HTTPS_SERVER', 'http://'.$_SERVER['HTTP_HOST'].'/admin/');
define('HTTPS_CATALOG', 'http://'.$_SERVER['HTTP_HOST'].'/');
Disabling maintenance mode did it for me.
In admin/controller/sale/order.php file line below 2438 you should see like this:
if ($store_info) {
$url = $store_info['ssl'];
} else {
$url = HTTPS_CATALOG;
}
As you can see CURL is allways use HTTPS_CATALOG defined constant which contain your shop SSL URL. Why? I don't now.
The solution: edit your config.php on shop root folder and change HTTPS_CATALOG defined constant value to non-ssl URL, simply delete "s" after end of https.

What happens when IIS sees the word set in a URL?

Having a strange issue - we have a page that uses a query string to get some information, this query string happens to contain the word set. When this happens, the page returns a 406 error (Client browser does not accept the MIME type of the requested page.)
The URL looks like example.com/folder/file.asp?variable=sunset boulevard. If I change the space to %20 it still returns 406.
On my local machine running IIS 5.x this doesn't happen, on our test server running IIS 7.x this doesn't happen, only on our production server running IIS 7.x over SSL. Note however that a self signed certificate on my local machine over SSL still doesn't produce the error.
So my question is, what does the set keyword in the URL tell IIS to do and is there an easy way to avoid it happening? I would like to avoid changing the space to a different character if possible.
Does your server have additional filters installed? Smells like the work of an agressive filter designed to prevent certain types of attack.

Resources